Advertisement
Guest User

Untitled

a guest
Jan 28th, 2013
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <?php
  2. // create an array with the variations for the product
  3. $variations = $options['value'];
  4. $variations = explode("|", $variations);
  5.  
  6. //for each variation create a form
  7. foreach ( $variations as $variation ) {
  8.         ?>
  9.         <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; ?>">
  10.             <?php woocommerce_quantity_input(); ?>
  11.             <button type="submit" class="button-link"><?php echo apply_filters('single_add_to_cart_text', __('Add to cart', 'woocommerce'), $product->product_type); ?></button>
  12.            
  13.             <input type="hidden" name="variation_id" value="" />
  14.             <input id="pack" type="hidden" name="attribute_pack" value="<?php echo $variation ?>">
  15.             <input type="hidden" name="product_id" value="<?php echo esc_attr( $post->ID ); ?>" />
  16.             <p><?php echo $variation; ?></p>
  17.         </form>
  18.        
  19.         <?php
  20. }
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement