Skip Navigation

[Résolu] Display Woocommerce Data on Child Posts

This support ticket is created Il y a 7 années et 3 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 réponses, has 2 voix.

Last updated by Beda Il y a 7 années et 3 mois.

Assisted by: Beda.

Auteur
Publications
#474897

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.

#474973

"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.

#475013
Screen Shot 2017-01-08 at 7.20.53 PM.png

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.

#475177

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.