• Resolved adamhopkins

    (@adamhopkins)


    Hi,

    I’m currently using a relationship Pods field on a project. That relationship ties a custom post to a Woo Commerce product. Then through a Pods template, I can pull through data from the related product such as title, stock, price and permalink.

    However, I am having trouble pulling through the product image. I’m not sure if this is possible using the Pods magic tags. I have managed to pull through the thumbnail ID of the related product using {@related_product._thumbnail_id} but I can seem to pull a image permalink (which would be good enough as I could simply add it to an tag.

    I know the data I have pulled through so far is basic text fields so I wanted to know if it was possible to pull through more advanced fields such as a product image or product description using magic tags in a Pods template?

    Any advice is much appreciated

    Adam

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @adamhopkins

    Please see our docs: https://docs.pods.io/displaying-pods/magic-tags/using-magic-tags/

    You can traverse through relationships, example:
    {@related_product.post_thumbnail}.

    Cheers, Jory

    • This reply was modified 3 years, 8 months ago by Jory Hogeveen.
    Thread Starter adamhopkins

    (@adamhopkins)

    Hi Jory,

    Apologies for the delayed reply.

    {related_product.post_thumbnail} is something I have already tried but nothing gets pulled through. I wonder if it maybe because I’m trying to pull the image from a WooCommerce product and maybe it’s more complex than pulling the post image from a more basic post type.

    It’s necessarily the thumbnail itself I need. The thumbnail permalink would be fine as I could add that to an img tag

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @adamhopkins

    Please keep in mind that extending the Product post type with Pods is a requirement for magic tags to work!
    Did you extend the Product post type created by WooCommerce?

    Cheers, Jory

    Thread Starter adamhopkins

    (@adamhopkins)

    I’m not too sure what you mean.

    My setup is that I have a custom post type (Featured Products) using Pods with a relationship field, that will relate the custom post to a WooCommerce product.

    I am using a Loop template and within that (inside Elementor) I am using a Pods template widget. Within that I have been able to pull through data from the WooCommerce product using magic tags such as {@related_product._regular_price}, {@related_product.title} etc.

    Did you extend the Product post type created by WooCommerce?

    I’m afraid I’m not too sure what you mean by this.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @adamhopkins

    When you create a new Pod you can choose between creating a new object or extending an existing. Please try and extend the WooCommerce “Products” custom post type.
    This might fix your issue.

    Cheers, Jory

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pulling data from a related Woo Commerce product’ is closed to new replies.