Changeset 3322590
- Timestamp:
- 07/05/2025 06:21:16 AM (9 months ago)
- Location:
- add-quantity-field-on-shop-page-for-woocommerce
- Files:
-
- 13 added
- 2 edited
-
tags/1.0.19 (added)
-
tags/1.0.19/add-quantity-field-on-shop-page.php (added)
-
tags/1.0.19/includes (added)
-
tags/1.0.19/includes/admin (added)
-
tags/1.0.19/includes/admin/assets (added)
-
tags/1.0.19/includes/admin/assets/img (added)
-
tags/1.0.19/includes/admin/assets/img/wvpd-icon.gif (added)
-
tags/1.0.19/includes/admin/class-aqf_plugin_installer.php (added)
-
tags/1.0.19/includes/plugin_compatibility.php (added)
-
tags/1.0.19/index.php (added)
-
tags/1.0.19/languages (added)
-
tags/1.0.19/languages/add-quantity-field-on-shop-page.pot (added)
-
tags/1.0.19/readme.txt (added)
-
trunk/add-quantity-field-on-shop-page.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
add-quantity-field-on-shop-page-for-woocommerce/trunk/add-quantity-field-on-shop-page.php
r3295075 r3322590 5 5 * Description: Display quantity field on the Shop / Archive page of WooCommerce. 6 6 * Author: Tanvirul Haque 7 * Version: 1.0.1 87 * Version: 1.0.19 8 8 * Author URI: http://wpxpress.net 9 9 * Text Domain: add-quantity-field-on-shop-page … … 13 13 * Tested up to: 6.8 14 14 * WC requires at least: 4.5 15 * WC tested up to: 9. 815 * WC tested up to: 9.9 16 16 * License: GPLv2+ 17 17 */ … … 34 34 * @var string 35 35 */ 36 public $version = '1.0.1 8';36 public $version = '1.0.19'; 37 37 38 38 /** … … 185 185 qty = jQuery(this).val(); 186 186 187 // Update data quantity 187 // Return on single product page (Not on related products) 188 if ( jQuery(this).closest(".type-product").find(".button").hasClass("single_add_to_cart_button") ) { 189 return false; 190 } 191 192 // Update data quantity for AJAX add-to-cart actions 188 193 add_to_cart_button.attr( "data-quantity", qty ); 189 194 195 // For non-AJAX add-to-cart actions 190 196 if( ! jQuery(this).closest(".type-product").hasClass("wvs-archive-product-wrapper") ){ 191 // For non-AJAX add-to-cart actions192 197 add_to_cart_button.attr( "href", "?add-to-cart=" + add_to_cart_button.attr( "data-product_id" ) + "&quantity=" + jQuery( this ).val() ); 193 198 } else { 194 199 // URL fix for Variation Swatches 195 196 // Create a complete URL for parsing 197 var new_url = new URL(href); 198 199 // Set the quantity parameter 200 new_url.searchParams.set("quantity", qty); 201 202 // Update the href 200 201 var new_url = new URL( href ); 202 new_url.searchParams.set( "quantity", qty ); 203 203 204 add_to_cart_button.attr( "href", new_url.toString() ); 204 205 } … … 218 219 219 220 // Support for Variation Swatches - Trigger on swatches selection and push quantity value with the add_to_cart_url as a parameter 220 jQuery( ".wvs-archive-variations-wrapper" ).on( "show_variation", function( e,data) {221 jQuery( ".wvs-archive-variations-wrapper" ).on( "show_variation", function( e,data) { 221 222 var add_to_cart_button = jQuery( this ).closest( ".product" ).find( ".add_to_cart_button" ), 222 223 href = add_to_cart_button.attr("href"), -
add-quantity-field-on-shop-page-for-woocommerce/trunk/readme.txt
r3295075 r3322590 1 1 === Add Quantity Field on Shop Page for WooCommerce === 2 2 Contributors: tanvirul 3 Tags: quantity, field, shop, woocommerce, variable products , variations3 Tags: quantity, field, shop, woocommerce, variable products 4 4 Requires PHP: 7.4 5 5 Requires at least: 4.8 6 6 Tested up to: 6.8 7 7 WC requires at least: 4.5 8 WC tested up to: 9. 89 Stable tag: 1.0.1 88 WC tested up to: 9.9 9 Stable tag: 1.0.19 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.