• Resolved scottbboss

    (@scottbboss)


    Shortcoder is fantastic, thank you so much for creating it.

    On a previous website, we used a combination of ACF, Static Blocks and Shortcoder to dynamically send people to a link based on the product they were viewing.
    The button would run a shortcode, with the code in Shortcoder being:

    /request-a-test-certificate?ProductSKU=$$custom_field:ProductSKU$$

    This works fine on the previous site.

    However, on this site, everything works except for the button. I initially thought there was a problem with ACF not grabbing the custom field, so I set the button text to be the ACF Field for the SKU and that works fine. It just doesn’t like the SKU=$$custom_field:SKU$$

    Hovering over the button shows the link as normal, just with the $$custom_field:SKU$$ part missing.

    I’ve tried deleting the field group and re-making it however the issue persists. Now I’m stumped.

    Any ideas?

    On the previous site we used WoodMart. This site we are using XStore.

    edit: pics added.

    Setting button text to SKU, and link to run the Shortcoder script.

    This is how it displays on the front-end. It’s grabbing the SKU, but won’t append it to the link (SKU=). How come?!

    • This topic was modified 1 year, 1 month ago by scottbboss.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @scottbboss,

    Thanks for using Shortcoder. Happy that you like it.

    Regarding your issue, I’m trying to understand your scenario.

    So you have a shortcode with content /request-a-test-certificate?ProductSKU=$$custom_field:ProductSKU$$

    This shortcode is now set as “link” to a button.

    You are expecting $$custom_field:ProductSKU$$ to be replaced with the current post’s custom field named “productSKU”.

    Can you please confirm if the current post (i.e the post where the button is present) has a custom field named “productSKU”?

    Thanks,

    Aakash

    Thread Starter scottbboss

    (@scottbboss)

    Thanks for your prompt reply.

    We are using products for the ACF field, and yes the product does indeed have the ProductSKU set.

    On this example, the “Fire Test Certificate” Download button executes the Shortcoder shortcode:

    Expected behaviour is that the URL of the button would be https://siteurl.com/documents-request?ProductSKU=FF-120-MD-BF-FL which would then populate our form on that page.
    However for some reason $$custom_field:ProductSKU$$ isn’t being executed.

    I made another Shortcoder snippet, this time with the code being:

    https://siteurl.com/documents-request?SKU=$$custom_field:ProductSKU$$

    I put the Shortcoder code into the product’s description and this isn’t working either. It’s almost like Shortcoder can’t find the relevant ACF field for the product.

    Edit: I added a button below the description which will use the ACF Field for ProductSKU as the button text. This works – which just makes me wonder why $$custom_field:ProductSKU$$ doesn’t.

    Front-end:

    Hopefully this makes a bit more sense. Happy to provide back-end access if you need to take a look.

    • This reply was modified 1 year, 1 month ago by scottbboss.
    Plugin Author vaakash

    (@vaakash)

    Hi Scott,

    Shortcoder does not pull data from ACF’s custom field. I’m not sure how it worked on your other site.

    It pulls data from WordPress’s custom field.

    Can you please create a custom field for “ProductSKU” in WordPress’s native custom field and see if it works?

    https://www.buildthatwebsite.com/custom-fields-gutenberg

    Thanks,

    Aakash

    Thread Starter scottbboss

    (@scottbboss)

    Many thanks vaakash, that has solved the problem!

    Plugin Author vaakash

    (@vaakash)

    Excellent! Great to hear!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not Passing Custom Field into URL?’ is closed to new replies.