Skip to content

Instantly share code, notes, and snippets.

@JustinSainton
Created April 10, 2015 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustinSainton/d426c20f8407fd96cb03 to your computer and use it in GitHub Desktop.
Save JustinSainton/d426c20f8407fd96cb03 to your computer and use it in GitHub Desktop.
Add quantity to add_to_cart shortcode.
<?php
add_action( 'wpsc_add_to_cart_button_form_end', function( $product_id ) {
?>
<fieldset><legend><?php _e('Quantity', 'wpsc'); ?></legend>
<div class="wpsc_quantity_update">
<input type="text" id="wpsc_quantity_update_<?php echo $product_id; ?>" name="wpsc_quantity_update" size="2" value="1" />
<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
<input type="hidden" name="wpsc_update_quantity" value="true" />
<input type='hidden' name='wpsc_ajax_action' value='wpsc_update_quantity' />
</div><!--close wpsc_quantity_update-->
</fieldset>
<?php
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment