DYNAMIC BULK ADD TO CART

USAGE & SCOPE
This widget must be placed on the template of the Parent item in a JetEngine relation setup.
Example Structure:
- Parent: Events (Single CPT Template)
- Child: WooCommerce Products
The widget will pull product IDs defined as Child items in the relation and add them to the cart in a single action. The quantity for each added product will always be 1 by default.
Additionally, you can manually define products instead of using a relation. In that case, set the source to Manual and provide product IDs and quantities directly.
DESCRIPTION
The Dynamic Bulk Add To Cart widget is a unique tool designed to handle bulk product additions to the cart based on a JetEngine relation setup. If the relation has products set as child items, the widget will fetch those products and add them to the cart as a single action.
In manual mode, you can define a custom set of products and their respective quantities using a repeater field or a structured meta field.
USAGE INSTRUCTIONS
1. Create a JetEngine Relation
In the JetEngine settings, set up a new relation:
- Parent: The main CPT, such as Events, Courses, or Bundles.
- Child: WooCommerce Products.
2. Assign Products to the Parent CPT
Open the parent CPT item and assign one or more products as related child items using the relation field.
3. Get the Relation ID
The relation ID can be found in the URL when editing the relation:
/wp-admin/admin.php?page=jet-engine-relations&cpt_relation_action=edit&id=2
4. Configure the Widget
Go to the template editor for the parent CPT (e.g., Single Event Template) and add the Dynamic Bulk Add To Cart widget. Set the relation ID and define the redirect location (Cart or Checkout).
WIDGET SETTINGS
-
Source:
- Relation: Select this to pull products from a JetEngine relation.
- Manual: Allows manual entry of product IDs and quantities.
- Relation ID: Enter the relation ID obtained from the relation settings URL.
- Button Label: Define the text to display on the button (e.g., "Add All to Cart").
-
Redirect After Add: Choose where to redirect the user after adding products:
- Cart
- Checkout
- Icon: Optionally, select an icon to display alongside the button label.
-
Manual Products (Only in Manual Mode):
- Choose a products and quantities through a repeater or structured field.
EXAMPLE USAGE
Relation-Based Example:
In this scenario, we have an Event CPT with related products (child items). The widget is placed within the Event template and configured to pull products based on the relation ID.
Manual Example:
If the source is set to Manual, the repeater field will allow the entry of multiple product IDs and their respective quantities. The button will then add these products to the cart with a quantity of 1 or the specified amount.
TIPS & BEST PRACTICES
- Ensure that the relation is correctly set up in JetEngine before configuring the widget.
- Use the manual mode for one-off product groupings that do not require a JetEngine relation setup.
- Consider adding custom icons for visual cues or additional context to the button.
- Test the redirect settings to ensure users are taken to the correct destination after adding products.