Posted on

How to change “Out Of Stock” Text

If any product is out of stock and you want to display custom massage for that product, you can do that using our plugin's Filter Hook.

function codeastrology_wpto_out_of_stock_text( $add_to_cart_text_final, $settings, $column_settings, $table_ID, $product){

    $StockQ = !$product->is_in_stock();
    if( $StockQ ){
        $add_to_cart_text_final = "Out of stock Massage";
    }
    return $add_to_cart_text_final;

}
add_filter( 'wpto_add_to_cart_text', 'codeastrology_wpto_out_of_stock_text', 10, 5);

Using that filter you can easily change Out of stock massage in the table. Use those code in your theme/child theme's functions.php file to manipulate out of stock massage.

Posted on

Manipulate Quantity After Add To Cart

By default in our product table quantity is 1 and when you add the product into the cart product quantity will back to 1. If you want to set product quantity 0 instead of 1, you can easily do it by using a filter hook called wpto_qty_return_zero.

add_filter("wpto_qty_return_zero","__return_true");

Now suppose you are using one of the quantity control plugin. In that case when you add product to the cart, quantity will back to the minimum value.

But you want that quantity should be the same increment value. For example, your product minimum quantity is 2 and you increase value to 6 and then add product to cart. Now you don't want that the quantity value set back to the minimum value 2. You want quantity value remain that increase value 6.

For that we just need to use 'wpto_qty_return_quanity' filter.

add_filter("wpto_qty_return_quanity","__return_false");
Posted on

Show Table in Only Shop page

When we turn on ‘Table On Archives’ table will show on WooCommerce Archive/Category/Tag/Attribute page. But if you only want to show table on shop page, we can do this using filter hook.

if (!function_exists('wpt_show_table_only_shop')) {
	function wpt_show_table_only_shop($my_archive, $template){
		if(!is_shop()){
			return $template;
		}
		else{
			return $my_archive;
		}
	}
	add_filter('wpto_archvie_page_template_loc', 'wpt_show_table_only_shop', 10, 2);
}