Total : 0.00 €

Change the price position in WooCommerce & WPC

There is a really simple and smart trick to change the position of the price in WooCommerce & WPC.

Follow these steps:

  • Install the "Simple CSS and JS" plugin, you can find it by clicking here: This plugin let you add custom CSS and JS code to your website. This is what we need to change the price position.
  • Create a new JS by clicking on "Custom CSS & JS > Add Custom JS".
  • Copy and paste the JS code below and save the JS code.
  • You're done, now you can see the price position has moved from top to page bottom.
Here is the JS code:
jQuery(document).ready(function( $ ){
    if($(".wpc_simulator_id").length){
      	$(".product .price").hide();
        $( ".wpc-product-form" ).after('<p class="price"><span class="woocommerce-Price-amount amount"></span></div>');
      
      	WooPriceCalculator.calculateProductPrice();
        
    }
});

Designing an Excel file for WooPrice Calculator

 

Among the very common and the most regular complains coming from the clients is about the Excel file they use for the WPC formula.
Whether it is about the slow processing speed or complex calculation, it certainly affects the performance of the calculator.
To handle such issues and provide a guideline in advance, our team of experts has created an Excel template which can be mapped or used for almost every kind of Excel formula which you want to write for your WooPrice Calculator.

Continue Reading

Showing calculator using Shortcode

If you want to show your calculator in a Wordpress page, you can use the WoooCommerce shortcode [product_page id="PRODUCT_ID"] to do that.

How to use your Shortcode?

In this example, it is explained how to show the calculator on a Wordpress "Page" (But of course you can add this shortcode wherever you want on your Wordpress website).

  1. In your WP-admin click on "Pages" > "Add new" (But if you have an existing page, edit it)
  2. Add the shortcode [product_page id="PRODUCT_ID"] ensuring that you are using the "Text" editor as in some cases the "Visual" editor can change your text and make your shortcode unable to work:

    shortcode product page

    Continue Reading

How to check WooCommerce add to cart price

If you want to check the WooCommerce product price before your customer adds a product to the cart, you cannot use the "woocommerce_add_to_cart_validation" function. But the following is a really smart trick about how to do that:

This piece of code checks if the price is 0, in this case, an error message will be shown and the product will be removed from the cart, so the customer cannot buy it.

Checking add to cart price

To make this piece of code work, you need to append it to your "functions.php" file, located in your "/wp-content/themes/YOUR_THEME/ path":

/* Price must be different from 0 to be added to the cart */
function filter_custom_wpc_add_to_cart_callback($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data){
	global $woocommerce;
	
	foreach(WC()->cart->get_cart() as $cart_item_key => $values){
		$cartItemPrice		= $values['data']->get_price();
		
		if($cartItemPrice == 0){
        
        	/* Showing the error message */
			wc_add_notice("Sorry but it's not possible to add this product to cart", "error");
            
            /* Removing the product from the cart */
			$woocommerce->cart->remove_cart_item($cart_item_key);
			
			return;
		}
	}
	
}
add_action('woocommerce_add_to_cart', 'filter_custom_wpc_add_to_cart_callback', 20, 6);

 

Continue Reading

More validation using WPC & WooCommerce

If you want to do more validation before adding a product to the cart (For example if you want to check "height + width" is less than a predetermined value), then this article is for you.

Using WooPrice Calculator you can set a minimum and maximum values for each field but you cannot validate more complex rules.

With Wordpress, WooPrice Calculator and WooCommerce this is really simple by using filters. You can use the filter "woocommerce_add_to_cart_validation" to do that.

How to make the validation?

For example, if you want check "height + width" must be less then 2000, you can append this new PHP function to your "functions.php" file, located in "/wp-content/themes/YOUR_THEME/": path.

function filter_custom_wpc_add_to_cart_validation($bool, $product_id, $quantity){
	if($product_id == 40){
		$width		= $_REQUEST['aws_price_calc_1'];
		$height		= $_REQUEST['aws_price_calc_2'];
		
		if(($width+$height) >= 2000){
			wc_add_notice("Width and Height are greater then 2000 mm", "error");
			
			return false;
		}
	}
	
	return true;
}
add_filter('woocommerce_add_to_cart_validation', 'filter_custom_wpc_add_to_cart_validation', 20, 3);

 

Continue Reading

Suggestions to write an efficient Excel formula

 

Excel formulas are great. We can calculate almost everything with their help. But their efficiency and performance will always be a big concern especially when they are being used to calculate some price in a live environment just as in our Woo Price Calculator.

Performance and efficiency of these formulas become a big concern when the calculations are very complicated and depend on lots of data and fields.

There are many suggestions and recommendations provided from experts regarding how to make your excel formula work faster or more efficiently.

We are helping you here with few of them:

Continue Reading

Setting up taxes in Woo Price Calculator

How to set up taxes

 

Image of woocommerce cart after adding a product using WPC

 

As you can see from the picture above, you will notice that there are the normal product price and the total price with tax applied in the Cart. Without the tax, the total price would be the same as the product price.

Continue Reading

WPC: Changing the price and changing numeric fields format

If you see wrong formatting while you are uploading your Excel file on WooPrice Calculator, never mind and please go ahead because there are numerous ways provided which allow you to change the price and numeric format after you have uploaded your Excel file.

- Changing the price format

If you want to change the price format, you have to change the WooCommerce price format:

  1. From your Wordpress back-end click on "WooCommerce"
  2. Click on "Settings" 
WooCommerce Price Formatting

Continue Reading

Clearing the cache in your Wordpress

If you added or changed CSS or Javascript code and you don't see any changes in your website front-end, this means you need to clear the cache.

Q: Yes, but what cache do I need to clear?

It depends on what plugins you have installed in your Wordpress website, but generally speaking:

  • You need to clear the cache of the browser (Whatever your website has been built on)
  • You need to clear the cache of your Wordpress cache plugins.

Q: I'm a web designer, how do I clear the cache of my browser?

For Chrome check out this video. For Firefox just hint CTRL+F5 on Windows and Linux. On Apple hint Apple+R.

You need to do this every time you change CSS or Javascript code on your website.

 

Continue Reading

Adding prefix/suffix to price in WooCommerce & WPC

If you would like to add prefix or suffix to your product price, you can use the hook "woocommerce_get_price_html" as following:

function change_product_price_html($price){
  	
	$newPrice 	 = "Text Before Price";
  	$newPrice 	.= $price;
  	$newPrice	.= "Text After Price";
  
	return $newPrice;
}
  
add_filter('woocommerce_get_price_html', 'change_product_price_html');

 

Continue Reading

Cart

Total : 0.00 €