• Resolved edwardsmark

    (@edwardsmark)


    hello – since kind people in this forum made the mistake of actually encouraging a stupid newbie question, here is yet another silly newbie question:

    i was trying to use a shortcode attribute more meaningful than id (which DOES work). i tried title, name, slug but none of these worked. finally i just copy-pasted the slug value into the unused sku field and that shortcode value sku works fine.

    was there another shortcode attribute for title, name or slug? oddly, they just seemed to show either the LAST or the FIRST product (i forget which).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi @edwardsmark,

    Great question—and not silly at all! In WooCommerce shortcodes like [product] or [products], the main supported attributes for identifying a product are typically id and sku. Unfortunately, attributes like titlename, or slug aren’t officially supported for fetching specific products in these shortcodes, which is why they didn’t work as expected.

    You can review the official WooCommerce shortcode documentation here:
    https://woocommerce.com/document/woocommerce-shortcodes/
    https://woocommerce.com/document/woocommerce-shortcodes/products/

    If you need to target products by attributes other than id or sku, you would usually need a custom query or plugin. But for shortcodes out-of-the-box, using id or sku is your best bet.

    I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the  WooCommerce Community Slack as custom code falls outside our usual scope of support.

    Thread Starter edwardsmark

    (@edwardsmark)

    which is why they didn’t work as expected.

    more like “didn’t work like i hoped and prayed it would”….!

    but i am just happy to have something working.

    Great question

    awww shucks, now i am blushing…..!

    Plugin Support LovingBro (woo-hc)

    (@lovingbro)

    Hi @edwardsmark,

    That made me smile — glad to hear you’re happy with the solution you’ve got working! Thanks for engaging in the forum, and if you ever have more questions down the road, feel free to open up a new topic here and we’ll be glad to help.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘another newbie shortcode question’ is closed to new replies.