Plugin Directory

Changeset 3322590


Ignore:
Timestamp:
07/05/2025 06:21:16 AM (9 months ago)
Author:
tanvirul
Message:

Release 1.0.19

Location:
add-quantity-field-on-shop-page-for-woocommerce
Files:
13 added
2 edited

Legend:

Unmodified
Added
Removed
  • add-quantity-field-on-shop-page-for-woocommerce/trunk/add-quantity-field-on-shop-page.php

    r3295075 r3322590  
    55 * Description: Display quantity field on the Shop / Archive page of WooCommerce.
    66 * Author: Tanvirul Haque
    7  * Version: 1.0.18
     7 * Version: 1.0.19
    88 * Author URI: http://wpxpress.net
    99 * Text Domain: add-quantity-field-on-shop-page
     
    1313 * Tested up to: 6.8
    1414 * WC requires at least: 4.5
    15  * WC tested up to: 9.8
     15 * WC tested up to: 9.9
    1616 * License: GPLv2+
    1717*/
     
    3434         * @var  string
    3535         */
    36         public $version = '1.0.18';
     36        public $version = '1.0.19';
    3737
    3838        /**
     
    185185                        qty = jQuery(this).val();
    186186
    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
    188193                    add_to_cart_button.attr( "data-quantity", qty );
    189194
     195                    // For non-AJAX add-to-cart actions
    190196                    if( ! jQuery(this).closest(".type-product").hasClass("wvs-archive-product-wrapper") ){
    191                         // For non-AJAX add-to-cart actions
    192197                        add_to_cart_button.attr( "href", "?add-to-cart=" + add_to_cart_button.attr( "data-product_id" ) + "&quantity=" + jQuery( this ).val() );
    193198                    } else {
    194199                        // 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                       
    203204                        add_to_cart_button.attr( "href", new_url.toString() );
    204205                    }
     
    218219               
    219220                // 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) {
    221222                    var add_to_cart_button = jQuery( this ).closest( ".product" ).find( ".add_to_cart_button" ),
    222223                        href = add_to_cart_button.attr("href"),
  • add-quantity-field-on-shop-page-for-woocommerce/trunk/readme.txt

    r3295075 r3322590  
    11=== Add Quantity Field on Shop Page for WooCommerce ===
    22Contributors: tanvirul
    3 Tags: quantity, field, shop, woocommerce, variable products, variations
     3Tags: quantity, field, shop, woocommerce, variable products
    44Requires PHP: 7.4
    55Requires at least: 4.8
    66Tested up to: 6.8
    77WC requires at least: 4.5
    8 WC tested up to: 9.8
    9 Stable tag: 1.0.18
     8WC tested up to: 9.9
     9Stable tag: 1.0.19
    1010License: GPLv2 or later
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.