This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 28th, 2013  |  syntax: PHP  |  size: 0.91 KB  |  views: 165  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ?>
clone this paste RAW Paste Data