Skip Navigation

[Resolved] Show product ID with link of bought product in cpt with cred commerce form

This support ticket is created 7 years, 3 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#555948
Screen Shot 2017-08-03 at 09.46.32.png
Screen Shot 2017-08-03 at 09.46.54.png

Here is what I have/kind of the components for this:

1. User with various "location" cpts
2. WooCommerce Subscriptions
3. Two CRED Commerce forms in each "location" cpt allowing to select one of two products/subscriptions

I have been reading over the WooSubscription action/filter reference and it seems like $product_id is used for the subscriptions just as for normal products which h´should hopefully make things easier.

Now here is what I want to achieve:

1. User goes into one of his "location" cpts
2. User selects one of two products
3. Location cpt has a custom field showing the $product_id of the ordered product
4. The custom field also has a link like this: hidden link

See the screenshot attached to see that that link is already generated by WooSubscriptions in the Subsciptions overview. I just need to also show it in the location cpt. A user may have 80 locations so he needs to be able to go into one and find that direct link to the subscription he bought for that location.

Any ideas? 🙂

Thanks a lot in advance 🙂

#556025

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Martin,

Thank you for contacting Toolset support. First you would need to create relationship between Location and Products / Orders post type.
https://toolset.com/documentation/toolset-training-course/part-8-one-to-many-relationships-in-toolset/

To create relationship between Location & Products or Orders CPT, you need to control it first with Types, you can do this by following the instructions added here (summary at top):
https://toolset.com/forums/topic/third-party-cpts-incl-woocommerce-products-order-unavailable-to-types/

In latest version of Views, we have Added support to query Woocommerce Orders with Views. Using that you will be able to achieve the results but its not documented so far and we are waiting for the doc to be published that will explain the process to use this newly added feature.
https://toolset.com/forums/topic/new-added-support-to-query-woocommerce-orders-with-views/#post-544295

Thank you

#556254
Screen Shot 2017-08-03 at 21.12.43.png

Hi Noman,

regarding point 2. I followed the instructions but now in the "Control Post Fields" I can't see any product fields, please see the screenshot attached.

The following code is what I used to de-register the woo-products before readding them using types using the same slug

function delete_post_type(){
    unregister_post_type( 'product' );
}
add_action('init','delete_post_type');

#556387

Also I have tried anyway to try to understand the process and now I am even more confused 😉 If I am to query the orders, that means I need to de-register and re-register with types the cpt "orders" correct? I tried for products and subscriptions and nothing was found.

I know the documentation isnt online yet and still being revised but please could you help me with the steps to query either orders or even better, active subscriptions whose author is current logged in user and parent is the post in which the view is being shown. Thanks a lot in advance 🙂

#556483

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello,

The code you are using to unregister is not needed. You can just deactivate WooCommerce plugin to link it with Types using the steps mentioned (same for products and orders CPT).

And this is needed only if you want to create relationship between Location CPT and Products or Orders.

For “Post Field Control” you don’t need to unregister CPT, that was a separate thing in that doc.

Please could you help me with the steps to query either orders
==> The process for this is not small, it takes many things to setup this properly. I am also not clear on this until doc is out and I can see how it works (since this feature is very new). So not possible at moment to outline the steps.

One thing I forgot to mention that you will be using Toolset WooCommerce Views plugin in this process.

Doc will be published here: https://toolset.com/documentation/user-guides/getting-started-woocommerce-views/

I can try to inform you once doc is out. Thanks

#556508

So you mean to simply deactivate for example woocommerce, create the "products" cpt and then activate woocommerce?

The "orders" cpt doesnt not really seem to be a cpt since I it doesnt really show anywhere, its just a part of woocommerce so I am a little confused here.

Is there any ETA on the docs? I mean I know you probably can't do that but even an unofficial unfinished version would be really helpful to wrap my head around this 😉

About Post control fields.. Ok so I dont need to un-register anything but how do I get for example the "products" fields to show up in there?

#556628

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

1. So you mean to simply deactivate for example woocommerce, create the "products" cpt and then activate woocommerce?
==> Yes, right and make sure to use same slug name as Products post type has.

Orders is basically a special CPT, as is shown under WP Dashboard >> WooCommerce >> Orders section. Its url is like: hidden link

2. Now for the doc, we have the Draft doc here which is going through Review process:
https://toolset.com/learn/create-an-ecommerce-wordpress-site/displaying-more-information-from-woocommerce/

-- Please note, there may be some updates added to it and we cannot guarantee this yet since this doc is not officially released at moment. I am just sharing this because you have insisted for this doc.

3. Post Field Control is a separate topic. Please kindly open a new ticket if you need help with this. This will help other users with similar problems to find solutions when searching the forum, I am not allowed to handle multiple issues in the same ticket as per support policy. https://toolset.com/toolset-support-policy/

==> However, these docs might help:
https://toolset.com/documentation/user-guides/letting-cred-edit-custom-fields-created-by-other-plugins/
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

Thanks

#556844

Awesome thanks a lot, worked out perfectly after all 🙂