I am trying to: Display data from Woocommerce product (Add to cart button - single product page) on child posts (name of child post type is 'Payments').
I visited this URL: hidden link
I followed the instructions give here - example 1 - https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
I used the following shortcode to display the options to buy the product:
[types field="wpv-woo-buy-options" id="$product"][/types]
but nothing shows up.
I want the options to purchase the product to be displayed on the child posts. (add to cart button, variations if any etc)
Please help.
"wpv-woo-buy-options" is not a Types Field or ShortCode, but a WooCommerce Views ShortCode, and as such can not be inserted in a Types ShortCode.
It's actually a own ShortCode on it's own.
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-woo-buy-options
It outputs the "Add to cart button" on the Product detail pages for simple products.
For Variable products, you would see a drop-down menu of Variations to select from.
The Only attribute is the "add_to_cart_text", so you can not use the ID attribute as example.
If you need to display this ShortCode you need to do it on the Product Itself, you can not call it via a parent Attribute.
Hi Beda,
does this mean I will not be able to use the Woocommerce Views Short code on any other custom post type (child / parent ) ?
is there any other way to show the options to buy a product (single product / variable product) on other custom post types?
I simply want to show the - Add to cart button for simple products and for Variable products, a drop-down menu of Variations to select from and button - on my custom posts 'Payments' (see attached screenshot)
So when someone visits the payment custom post type page they will only see the options to actually buy the product.
Please help.
The Only attribute is the "add_to_cart_text", so you can not use the ID attribute as example.
I can not change that, it's by design.
And to call the Parent Post you would need an ID attribute.
It is elaborated on the DOC that this shortcode outputs the Add to cart button on the Product detail pages.
What you can do is invert the Relationship as example.
Let's say your Products are CHILD to another Post type, then you can display the Product according it's parent on that Post, and the add to cart button will work on that View that displays the Child (Product)
Main idea is, the ShortCode needs to be used directly on the Product it applies to.