-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Bundle Widget
WildWomble edited this page Dec 22, 2023
·
1 revision
In the backend, you MUST select a Main Product or else the widget will not function as intended, like so:
The widget will use the product of your choice to be added to cart with the chosen variations, example:
Upon choosing all the steps, the add to cart button will show up (it is sticky)
Once clicked, it will tell you that the product has been added to cart with its choices.
In the cart, the Main Product is added with the chosen variations:
The price will be that from the Main Product
NOTE: Most themes will NOT display the variations chosen in the cart/checkout page, you can use a function like the following to make them visible on the frontend.
function modify_woocommerce_get_item_data( $item_data, $cart_item ) {
$variations = $cart_item['variation'];
$output = null;
$output = "<ul style='list-style-type: none'>";
foreach ( $variations as $key => $value ) {
$output .= "<li><span style='font-weight: bold'>{$key}</span>: <span>{$value}</span></li>";
}
$output .= "</ul>";
echo $output;
}
add_filter( 'woocommerce_get_item_data', 'modify_woocommerce_get_item_data', 99, 2 );