// Add checkbox and input field to general tab add_action(‘woocommerce_product_options_general_product_data’, ‘add_custom_fields_to_general_tab’); function add_custom_fields_to_general_tab() { global $post; // Retrieve the current values of the checkbox and input field $checked = get_post_meta($post->ID, ‘_allow_discount’, true); $required_quantity = get_post_meta($post->ID, ‘_required_quantity’, true); // Output the…Continue reading
// Add checkbox and input field to general tab add_action(‘woocommerce_product_options_general_product_data’, ‘add_custom_fields_to_general_tab’); function add_custom_fields_to_general_tab() { global $post; // Retrieve the current values of the checkbox and input field $checked = get_post_meta($post->ID, ‘_allow_discount’, true); $required_quantity = get_post_meta($post->ID, ‘_required_quantity’, true); // Output the…Continue reading
// Hook to apply progressive discount based on cart quantity add_action(‘woocommerce_cart_calculate_fees’, ‘progressive_discount’, 20, 1); function progressive_discount($cart) { // Check if the action is not triggered in the admin and not during AJAX if (is_admin() && !defined(‘DOING_AJAX’)) return; // Define progressive…Continue reading
/* Plugin Name: SuperWp WhatsApp Product Enquiry Description: Adds a WhatsApp enquiry button to WooCommerce product pages with customizable options, custom messages, and phone number input. Version: 1.0.3 Author: Thiarara SuperWP */ // Add WooCommerce Submenu for WhatsApp Enquiry Settings…Continue reading
// Exit if accessed directly if (!defined(‘ABSPATH’)) { exit; } // Check if WooCommerce is active if (!in_array(‘woocommerce/woocommerce.php’, apply_filters(‘active_plugins’, get_option(‘active_plugins’)))) { add_action(‘admin_notices’, ‘superwp_wc_not_active_notice’); function superwp_wc_not_active_notice() { ?>Continue reading
// 1. Add Woocommerce cart page on the checkout page add_action( ‘woocommerce_before_checkout_form’, ‘add_cart_on_checkout’, 5 ); function add_cart_on_checkout() { if ( is_wc_endpoint_url( ‘order-received’ ) ) return; echo do_shortcode(”); // Woocommerce cart page shortcode } // 2. Redirect cart page to checkout…Continue reading
// Add custom checkbox and WhatsApp number fields to product edit page add_action(‘woocommerce_product_options_general_product_data’, ‘add_whatsapp_order_fields’); function add_whatsapp_order_fields() { woocommerce_wp_checkbox(array( ‘id’ => ‘allow_whatsapp_order’, ‘label’ => __(‘Allow WhatsApp Order’, ‘text-domain’), ‘description’ => __(‘Check this box to enable WhatsApp ordering for this product.’, ‘text-domain’),…Continue reading
/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading