Support » Plugin: WooCommerce » ShortCode does’t work

  • Resolved makroflex

    (@makroflex)


    Hello.

    I created a new page and inserted short code [product_page id=”99″], but I cannot see my product page, what I can see just a code as a text. Why?

    P.s I tried different short codes, for example: cart, they are working fine.

    Thanks

    I added a screenshot:

    Photo1

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support John Coy

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @makroflex,

    The shortcode [product_page id=”99″] is to add a single specific product to any page using the ID of the page, in this case 99. You also can use a specific product SKU using [product_page sku="FOO"], replacing FOO with your product’s SKU.

    If you’d like to set the shop page that displays all of your products, you can do so under WooCommerce > Settings > Products > Shop page. Hope this helps.

    What I want to do is make my Home Page as one product. I can do it this way:

    1. Create a page and insert my product with that code [product_page id=”99″]
    2. Set that page as HomePage.

    BUT THAT IS NOT WORKING. When I add this code [product_page id=”99″] to my page, I can see only code…

    I created a lot of woocomerce webpages and first time I got that problem.

    Plugin Support John Coy

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @markoflex,

    Can you confirm that 99 is the correct ID you should be using? You can get the correct ID of the product you’d like to display by editing the product from the WP Admin and obtaining the ID from the URL:

    http://cld.wthms.co/I1vcdX

    Hope this helps.

    Of Course I checked my product ID and I changed it, also I tried to do same thing with SKU, but also does not work.

    EDIT:

    I added video if somebody not understand what I want to say:

    Public Google Drive link: https://drive.google.com/file/d/1VX3L34MrDkT4jRhmvRhMkxqLqb-lmm6D/view

    P.s I am using WPBakery Page Builder maybe it can effect it. What do you think?

    • This reply was modified 1 year, 8 months ago by makroflex.
    Plugin Support John Coy

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @makroflex,

    Thanks for confirming the use of the correct ID. The page builder could be effecting it since you’ve added in into the Text view of the editor. Have you tried switching back to a default theme like Twenty Seventeen or Storefront and disabling all plugins except for WooCommerce to see if this resolves the issue?

    I have a similar problem. The pages where I used [product_page id=”99″] (with the proper ID of course) do not display the product page anymore.
    I only noticed it yesterday but it happened before the latest update to 3.4.0… I think it took place with update 3.3.5.
    If I inspect the page then it appears that the whole “description” etc… is not loaded on the page.
    I tried changing the Id for SKU but same result.

    The only thing I could manage to have is the summary… but I asked through css not to see it displayed.
    As a result I only get related products!

    I changed my theme to default and it is working! (I did not disable any plugins) Now I have several ideas what I can do. I will write after my tests.

    Plugin Support RK

    (@riaanknoetze)

    @makroflex – thanks for reporting back 🙂

    If switching themes did the trick for, then it likely means that there’s some custom code (or a template override) that’s affecting that shortcode. It might be worthwhile getting in touch with your theme developers to take a closer look into that for you.

    I will. But here something is crazy. All short codes are working perfectly except [product_page id="942"]…It is so annoying for me. When WPBakery is disabled everything are fine, but when I turn it on again, I see only short code as text. 😐

    Mikey Arce

    (@mikeyarce)

    Automattic Happiness Engineer

    When WPBakery is disabled everything are fine, but when I turn it on again, I see only short code as text. 😐

    Hmmmm – are you making sure to enter the shortcode into an “HTML” type editing? I wonder if WPBakery is converting it thinking it’s just text and stripping out the important parts. Try going into some kind of “HTML” or “Text” editing instead of WPBakery and see if that helps.

    I tried everything, it’s not working. All others themes has “Add Product Page” in WPBakery and I can add a new product to page easily. This theme doesn’t have it, but it MUST work with that shortocode…

    I was having the same issue, I think, but I’m not using any sort of page builder.

    I ended up getting it working, but I’m not really sure why it works now, and why it didn’t before.

    Some clues though from looking for my revision history for the page.

    • First, using the HTML editing mode I entered the [products] shortcode, specifying the skus=”XXX” atribute. The version history shows that a span was injected starting after the first quote, and ending after the closing square bracket for the short code.[products skus="<span style="caret-color: #555555; color: #555555; font-size: 13px; background-color: #f9f9f9;">S9-001"]</span>
    • Next, I added the columns attribute. I’m not sure if it had any effect — I didn’t quote the numeric argument (or it was stripped — but the page still showed the product summary. The html shows that the added argument is within the existing span
    • Then I edited the shortcode in place by deleting the ‘s’ at the end and adding ‘_page’. I didn’t change the arguments/attributes (ie I left ‘skus’, rather than changing it to ‘sku’). When I saved and reloaded the page, the content area was blank.
    • Next, I corrected ‘skus to ‘sku’ and it still was blank.

    What finally got it working again was to switch to the text view, get rid of the HTML and then enter the ‘product_page’ shortcode again.

    What’s really odd is that a) the products shortcode worked fine, even though it had HTML mixed in with it. b) that I can’t get the editor to mangle the product_page shortcode with HTML now.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘ShortCode does’t work’ is closed to new replies.