Skip to content

Instantly share code, notes, and snippets.

@codeastrology-dev
codeastrology-dev / plus-minus_button_ajax_update.php
Created November 29, 2021 05:18
This code will update cart quantity on cart page when some one click on + or - button.
<php
add_action( 'wp_footer',function(){
?>
<script>
jQuery( document ).ready(function($) {
let updateButton = $('body.woocommerce-cart.woocommerce-page.woocommerce-js td.actions button.button[name="update_cart"]');
$(document.body).on('change','input.wqpmb_input_text.input-text.qty.text',function(){
setTimeout(function(){
updateButton.trigger('click');
<?php
function wpto_shortmessage_string_callback( $msg_label ){
$msg_label = __( 'Extra Note', 'wpt_pro' );
return $msg_label;
}
add_filter( 'wpto_shortmessage_string' , 'wpto_shortmessage_string_callback' );
/****************************
* CUSTOM CODE FOR WOO PRODUCT TABLE
* Here we have used important, because Our theme has override and Woo Product Table plugins Style.
****************************/
.wpt_product_table_wrapper p.woocommerce-mini-cart__buttons.buttons {
display: inline-flex;
float: right;
}
.wpt_product_table_wrapper p.woocommerce-mini-cart__buttons.buttons a.button {
@codeastrology-dev
codeastrology-dev / wpto_viewed_product_message.php
Created October 21, 2021 05:14
This filter will change Viewed text
<?php
add_filter('wpto_viewed_product_message', function(){
return __( "Visited", 'wpt_pro' );
});
@codeastrology-dev
codeastrology-dev / hide_view_cart_next_to_add_to_cart.php
Created October 17, 2021 12:01
This filter will hide view cart next to add to cart button after a product added to the cart.
<?php
add_filter( 'wpto_add_to_cart_view' , function(){
return false;
});
<?php
remove_action( 'woocommerce_single_product_summary', 'wpt_show_variation_table', 3 );
add_action( 'woocommerce_single_product_summary', 'wpt_change_variation_table_location', 3 );
function wpt_change_variation_table_location(){
global $product;
//var_dump($product->get_type());
if( $product->get_type() !== 'variable' ) return;
<?php
add_action('wpto_action_table_wrapper_top','check_cart_weight');
function check_cart_weight(){
global $woocommerce;
$weight = $woocommerce->cart->cart_contents_weight;
if( $weight > 20 ){
echo sprintf( __( '<div class="woocommerce"><ul class="woocommerce-error" role="alert">
<li>
You have reached your weight allowed limit per order currently at %sKg, we allow only 20kg of weight per order . If you require more items please check out this order and start a new order. </li>
@codeastrology-dev
codeastrology-dev / quantity.php
Created September 14, 2021 12:19
To solve the issue please create a file with named quantity.php and upload it to your current theme's directory under woo-product-table/items. Read this article https://wooproducttable.com/overriding-templates-of-columns-via-a-theme/ to override plugin file from theme.
<?php
/**
* Checking if is_sold_individually
* then wc will not show qty box
* that's why, I return default template
*
* rest will handle from WooCommerce
*
* @since 1.0.8
*/
<?php
function codeAstrology_wpto_localize_data_callback($WPT_DATA){
$WPT_DATA['select2'] = 'disable';
return $WPT_DATA;
}
add_filter('wpto_localize_data','codeAstrology_wpto_localize_data_callback');
@codeastrology-dev
codeastrology-dev / taxonomy_multiple_off.php
Last active September 12, 2021 11:12
This hooks turn off dropdown multiple selection.
<?php
function codeAstrology_wpto_taxonomy_multiple_off($bool){
return false;
}
add_filter('wpto_is_multiple_selectable','codeAstrology_wpto_taxonomy_multiple_off');