Skip Navigation

[Resolved] Add Select Box Next To Loop Items

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.

Our next available supporter will start replying to tickets in about 5.72 hours from now. Thank you for your understanding.

This topic contains 5 replies, has 2 voices.

Last updated by marcusC-4 4 years, 6 months ago.

Assigned support staff: Noman.

Author
Posts
#533417

I am trying to add a select option next to my loop items. I'd like for users to be able to choose one the one they want & then have the details (custom field data) be added to their product in WooCommerce.

Here is the URL where you can see what I'm trying to do: hidden link

You have to enter GHE2017 to view the site.

In the Description area, you can choose a date & location. Those details were setup using a custom post type called "Course Dates" that is a child post type of Products.

I used this help thread to create the "Select" option: https://toolset.com/forums/topic/create-select-box-with-posts-from-cpt/

Once someone selects the date & location they want, how do I add that data their shopping cart? I just need a way to show them on the shopping cart which date & location they chose.

I will also want to add that same information to their confirmation email & their profile, but I hope the same process will work for all 3 instances.

I hope this makes sense. Please let me know if you have any questions or are able to help.

Thanks,

Marcus

#533455

Noman
Supporter

Languages: English (English )

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

Hi Marcus,

Thank you for contacting Toolset Support.

Our Woocommerce Views plugin is not able to modify the Checkout and Cart page templates.
You are only able to modify your Shop and product pages with woocommerce views.
So if you want to modify your Checkout and Cart pages you will need to modify the woocommerce php templates for these pages.

I suggest you to use WooCommerce product variation instead of adding Select option in Product Description. Here is related doc that can help you:
https://docs.woocommerce.com/document/variable-product/

Thank you

#533466

Noman,

Thank you for the reply & info. I would use their Variables add-on except that I need to be able to make the Variable into child posts of another post type (called Courses). I’m using the LearnDash plugin & trying to find a way to create live courses with multiple dates & locations. It’s surprisingly more complicated than I anticipated. Seems like something a lot of people would want to do.

Anyway, I’ll look into the WooCommerce files or see if there’s a way to create a plugin that automatically inserts the Types fields into the cart for me.

Thanks,

Marcus

#533476

Sorry, I need to reopen this -- forgot to ask an important question: how do I display the "selected" option on the front-end?

What would be the php or Types code to pass along the user’s selection?

Thanks,

Marcus

#533694

Noman
Supporter

Languages: English (English )

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

Hello Marcus,

How do I display the "selected" option on the front-end?
==> You can display any custom field by creating a Content Template for the products. And you may also want to use WooCommerce Views to add various WC options / shortcodes in the content template:

https://toolset.com/documentation/user-guides/view-templates/
https://toolset.com/learn/create-an-ecommerce-wordpress-site/create-custom-fields-and-taxonomies/

I would suggest to put your dropdown options as a custom field outside of description, like any other custom field attached to the product / post. Because the description is not submitted when we add a product to the cart.

Not quite sure what code to use but you can try to use Types API for Select field and/or other fields, it also has usage sample php code:
https://toolset.com/documentation/customizing-sites-using-php/functions/#select

Thank you

#533775

Sounds good. I’ll look into this. I appreciate the advice & resources.

Thanks,

Marcus