Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // create an array with the variations for the product
- $variations = $options['value'];
- $variations = explode("|", $variations);
- //for each variation create a form
- foreach ( $variations as $variation ) {
- ?>
- <form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="variations_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo $post->ID; ?>">
- <?php woocommerce_quantity_input(); ?>
- <button type="submit" class="button-link"><?php echo apply_filters('single_add_to_cart_text', __('Add to cart', 'woocommerce'), $product->product_type); ?></button>
- <input type="hidden" name="variation_id" value="" />
- <input id="pack" type="hidden" name="attribute_pack" value="<?php echo $variation ?>">
- <input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" />
- <p><?php echo $variation; ?></p>
- </form>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement