Disabling the default /?add-to-cart= animation on buttons in Woocommerce

Disabling the default /?add-to-cart= animation on buttons in Woocommerce

Content Index :

Disabling the default /?add-to-cart= animation on buttons in Woocommerce
Tag : php , By : user157138
Date : November 24 2020, 03:01 PM

wish help you to fix your issue I would like to remove the default /?add-to-cart= animation buttons on the Shop Archive page. The default mode on a simple product shows a little spinner after clicking the button before showing a tick and providing a "View Cart" option link. (See here: https://snag.gy/ZreQid.jpg) , Here is the solution
function change_simple_shop_add_to_cart( $html, $product ){
    if( $product->is_type('simple')) {

        $html = sprintf( '<a rel="nofollow" href="%s" data-product_id="%s"  class="button">%s</a>',
                esc_url( get_the_permalink() ),
                esc_attr( $product->get_id() ),
                esc_html(  __( 'View Product', 'woocommerce' ) )
    return $html;

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

how to disabling shop cart in woocommerce?

Tag : wordpress , By : Hugo
Date : March 29 2020, 07:55 AM
I wish this helpful for you I finally found this solution: i install this plugin to wordpress ecommerce-Product

Woocommerce Plus/Minus buttons on cart

Tag : javascript , By : user112141
Date : March 29 2020, 07:55 AM
Does that help I have a code that works just fine for the first time, but once the cart has been updated, the buttons stop working. Here is my HTML , Solved it with this:
 jQuery(function($) {

$( document ).on( 'click', '[name=prqu_minus]', function() {
     var $input = $(this).parent().find('input');
     var count = parseInt($input.val()) - 1;
     count = count < 1 ? 1 : count;
     $( 'div.woocommerce > form input[name="update_cart"]' ).prop( 'disabled', false );
     return false;

$( document ).on( 'click', '[name=prqu_plus]', function() {
     var $input = $(this).parent().find('input');
     $input.val(parseInt($input.val()) + 1);
     $( 'div.woocommerce > form input[name="update_cart"]' ).prop( 'disabled', false );
     return false;


Set custom Add to cart default quantity except on Woocommerce cart page

Tag : php , By : firebasket
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I'm using this filter below to to set default quantity of 2 products to be predefined when adding to cart by default. It actually works on product page and defaults quantity setting to 2 and adds 2 products to Cart. But the problem appears when user comes to Cart page, if he/she added 4 products, all the calculations are done correctly EXCEPT displayed quantity is 2. Even if I change quantity on Cart page to 6 for example, and refresh Cart, all the amounts are recalculated correctly except displayed quantity is shown as 2. I figure I should somehow apply this filter to Add to cart button only, but don't know how. , Try the following using is_cart() on 'input_value' argument:
add_filter( 'woocommerce_quantity_input_args', 'custom_quantity_input_args', 10, 2 );
function custom_quantity_input_args( $args, $product ) {

   if( ! is_cart() )
       $args['input_value'] = 2; // Not on cart page

   $args['max_value'] = 12;
   $args['min_value'] = 1;
   $args['step'] = 1;

   return $args; 

Disabling Add to Cart Button for Specific WooCommerce Products

Tag : php , By : Monev
Date : March 29 2020, 07:55 AM
around this issue I have tested your code and it work without problems… I don't have the problematic behavior you describe… So something else is making trouble:
You will need first to make a database backup… Then you should try to:
// Add a custom field in the Product data's General tab (for simple products).
add_action( 'woocommerce_product_options_general_product_data', 'add_general_product_data_custom_field' );
function add_general_product_data_custom_field() {
    woocommerce_wp_checkbox( array( // Checkbox.
        'id'            => '_not_ready_to_sell',
        'label'         => __( 'Call to Order', 'woocommerce' ),
        'wrapper_class' => 'show_if_simple',
    ) );

// Save custom field value
add_action( 'woocommerce_admin_process_product_object', 'save_general_product_data_custom_field', 10, 1 );
function save_general_product_data_custom_field( $product ) {
    $product->update_meta_data( '_not_ready_to_sell', isset( $_POST['_not_ready_to_sell'] ) ? 'yes' : 'no' );

// Make not purchasable, products with '_not_ready_to_sell' meta data set to "yes" (for simple products)
add_filter( 'woocommerce_is_purchasable', 'filter_woocommerce_set_purchasable', 10, 2);
function filter_woocommerce_set_purchasable( $purchasable, $product ) {
    return 'yes' === $product->get_meta( '_not_ready_to_sell' ) && $product->is_type('simple') ? false : $purchasable;


// Change button text to "Call to Order" for simple products not purchasable.
add_filter( 'woocommerce_product_add_to_cart_text', 'filter_product_add_to_cart_text', 10, 2 );
function filter_product_add_to_cart_text( $button_text, $product ) {
    if ( 'yes' === $product->get_meta( '_not_ready_to_sell' ) && $product->is_type('simple') ) {
        $button_text =  __( 'Call to Order', 'woocommerce' );
    return $button_text;

Woocommerce - Add To Cart and Buy Now buttons on Product Pages

Tag : php , By : user155548
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Cannot access private property with Set method in Symfony
  • How to compare 2 array of PHP objects then fill in empty string if data not match?
  • strtotime gives back false result to strings in an array
  • How to create Url that contain name and id laravel
  • Codeigniter: Models not working with an error: Undefined property: CI_Loader
  • How to use + or - operators as parameters in Doctrine prepared SQL statement?
  • How to run scrapy with url parameters from php on linux debian
  • Preg matching imgur.com links
  • Php - Code comparing value of database to the value send by android app
  • Laravel pagination object in javascript
  • Error in validating message of no votes PHP
  • Symfony site on Azure with ClearDB connection
  • Woocommerce upsell with checkboxes
  • How to login/logout with Hybridauth 3?
  • Convert INT number in PHP
  • php/mysql. selecting 2 common fields in 2 tables
  • Expand an string based on values in an array in PHP
  • When you absolutely have to manually escape SQL in CakePHP 3.4.7
  • Htaccess redirecting wrong page
  • Laravel Optional WHERE clause
  • PHP unpack overlfow variable memory limit
  • How to check the URL's structure using PHP preg_match?
  • PHP preg_replace - text will not be recognized
  • Show image from other domain without showing the domain name - PHP
  • How to run and watch local server at the same time?
  • Access form request from Observer laravel
  • single quote problem with preg_replace_callback
  • How to Create A Unique URL for each product enquiry form for Google Analytics Tracking
  • Laravel email configuration: what am I missing?
  • Assign indexed array values to multidimensional array?
  • Custom WordPress stylesheet not loading
  • Data attribute only returning first value
  • How to list all roles with Permissions,in spatie permission Package?
  • How to achieve this number pattern with n input
  • How to iterate array inside array data in laravel ,output are given below
  • To get output of movie with its genre
  • Extracting some data from a JS object literal string in PHP using Regex
  • axios and vuex are deleting wrong index in array
  • Setting empty CURLOPT_POSTFIELDS
  • Laravel 5.8 use subdomain as API endpoint beside domain.com/api
  • Error while add data in database SQL Server 2016
  • Does PhpStorm allow to skip PHPDoc tags when type hints is declared?
  • html classes are changed to Attributes
  • Using json to import multidimensional data
  • passing data from the view to the controller, where the data comes from another controller
  • How to extract integer and decimal numbers in PHP string correctly?
  • Parsing Sub-Object from an XML Feed with objects
  • Getting error "Unknown column 'text' in 'field list'"
  • How to properly get onedrive access token via php and curl
  • How to add spell check to a php function
  • Is it posible to create css rules with php?
  • Pretty URL with $_GET method
  • Wordpress always load same page - index.php
  • Find value in array and return with new from different array
  • PHP multiple file upload with different keys
  • Can't modify times one a time without weird errors
  • Get size of scraped image with domcrawler (Goutte)
  • Laravel - Ordering a collection of models
  • PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on boolean
  • Strict Standards: Only variables should be passed by reference in /main_dir/sub_dir/backup.php
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com