Calling calculate_shipping() with ajax in woocommerce

I also have the same issue when I created a shipping method and what I did is on my function for the ajax call I add something just to have an update on the cart: global $woocommerce; $packages = $woocommerce->cart->get_shipping_packages(); foreach( $packages as $package_key => $package ) { $session_key = ‘shipping_for_package_’.$package_key; $stored_rates = WC()->session->__unset( $session_key … Read more

Woocommerce – disable «place order» until user checks Privacy Policy

I think you should jQuery to enable and disable the checkout button. Please try this script. Put this script in the footer.php. jQuery(window).on(‘load’,function(){ setTimeout(function(){ jQuery(‘#payment #place_order’).attr(“disabled”,”disabled”); console.log(‘Hello’); },1000); }); jQuery(document).on(‘change’,’#privacy_policy_field #privacy_policy’,function() { var ischecked= jQuery(this).is(‘:checked’); if(!ischecked){ jQuery(‘#payment #place_order’).attr(“disabled”,”disabled”); console.log(‘unchecked’); }else{ jQuery(‘#payment #place_order’).removeAttr(“disabled”); console.log(‘checked’); } }); Note: This is tested script for your code.

Woocommerce Shop Price Position

It appears but above the Title and outside the custom div. What am I doing wrong? It’s because woocommerce_template_loop_price() echoes the output. So to fix the problem, just use ?> HTML here <?php instead of echo ‘HTML here’;: function custom_woocommerce_template_loop_product_title() { ?> <div class=”custom-title-wrapper”> <h1 class=”woocommerce-loop-product__title custom-loop-product-title”><?php the_title(); ?></h1> <h2><?php woocommerce_template_loop_price(); ?></h2> </div> <?php } … Read more

Display WooCommerce only in stock sizes product attribute on shop page

To get only available “In stock” displayed sizes, you need something a little more complicated and different: add_action( ‘woocommerce_after_shop_loop_item_title’, ‘display_instock_sizes’, 5 ); function display_instock_sizes() { global $product; if ( $product->is_type(‘variable’) ) { $taxonomy = ‘pa_size’; // The product attribute taxonomy $sizes_array = []; // Initializing // Loop through available variation Ids for the variable product … Read more

Show all author products from specific category

Pass author data to the query. It should be that hard. Author Parameters Show posts associated with certain author. author (int) – use author id. author_name (string) – use ‘user_nicename’ – NOT name. author__in (array) – use author id (available since Version 3.7). author__not_in (array) – use author id (available since Version 3.7). Of course, … Read more

Creating woocommerce product using WordPress REST API

The new api’s documentation can be found here Woocommerce Rest API And you can create a Woocommerce product by posting data to the wp-json endpoint /wp-json/wc/v1/products (Documentation Here) $data = [ ‘name’ => ‘Premium Quality’, ‘type’ => ‘simple’, ‘regular_price’ => ‘21.99’, ‘description’ => ‘Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)