Codex Topic: WooCommerce

  • Creating Custom Field Metabox Without ACF

        // Hook into the ‘admin_init’ action add_action(‘add_meta_boxes’, ‘custom_add_custom_box’); // Function to register the new meta box function custom_add_custom_box() { add_meta_box( ‘custom_meta_box_id’, // ID of meta box ‘Custom Text’, // Title of the meta box (renamed to “Custom Text”) ‘custom_meta_box_callback’, // Callback function ‘custom’ // Screen to which to add the meta box (e.g.,…

  • Changing Add to Cart button Text with something else

    Changing Add to Cart button Text with something else     // Change add to cart text on single product page add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woocommerce_add_to_cart_button_text_single’ ); function woocommerce_add_to_cart_button_text_single() { return __( ‘Add to Cart Button Text’, ‘woocommerce’ ); } // Change add to cart text on product archives page add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woocommerce_add_to_cart_button_text_archives’ ); function woocommerce_add_to_cart_button_text_archives() {…

  • Adding Minimum Order Amount Count on Cart

    Adding Minimum Order Amount Count on Cart   It is possible to make this with some plugins and addons but this method much simpler and faster. Less plugin is the better.   add_action( ‘woocommerce_checkout_process’, ‘wc_minimum_order_amount’ ); function wc_minimum_order_amount() { global $woocommerce; $minimum = 50; if ( $woocommerce->cart->get_cart_total(); < $minimum ) { $woocommerce->add_error( sprintf( ‘You must…

  • Single Product Tab Name Change or Renaming or Replacing

    Single Product Tab Name Change or Renaming or Replacing add_filter( ‘woocommerce_product_tabs’, ‘woo_rename_tab’, 98); function woo_rename_tab($tabs) { $tabs[‘description’][‘title’] = ‘More info’; return $tabs; }

  • Hiding Product Counts in The Category View

    Hiding Product Counts in The Category View   add_filter( ‘woocommerce_subcategory_count_html’, ‘woo_remove_category_products_count’ ); function woo_remove_category_products_count() { return; }  

  • Replace “Out of Stock” Word with “Sold” or Anything

    Replace “Out of Stock” Word with “Sold” or Anything   add_filter(‘woocommerce_get_availability’, ‘availability_filter_func’); function availability_filter_func($availability) { $availability[‘availability’] = str_ireplace(‘Out of stock’, ‘Sold’, $availability[‘availability’]); return $availability; }