Disable a Payment Gateway for a country on WooCommerce Checkout Page

/** * Snippet: Disable a Payment Gateway for a country */ add_filter( ‘woocommerce_available_payment_gateways’, ‘disable_payment_gateway_based_on_country’, 9999 ); function disable_payment_gateway_based_on_country( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( isset( $available_gateways[‘stripe’] ) && WC()->customer && WC()->customer->get_billing_country() == ‘IN’ ) {…Continue reading

Show ‘NEW’ Badges for Recently Added Items in WooCommerce

/** * Snippet Name: Show ‘NEW’ Badges for Recently Added Items in WooCommerce * Snippet Author: wdxtechnologies.com */ // Show the NEW badge on the archive loop item add_action( ‘woocommerce_after_shop_loop_item_title’, ‘ecommercehints_product_archive_new_badge’, 1 ); function ecommercehints_product_archive_new_badge() { global $product; $days_to_show =…Continue reading

Add column Product type in WooCommerce

// Add column: Product type add_filter( ‘manage_edit-product_columns’, ‘huk_admin_products_visibility_column’); function huk_admin_products_visibility_column( $columns ){ $columns[‘product_type’] = ‘Type’; return $columns; } add_action( ‘manage_product_posts_custom_column’, ‘huk_admin_products_visibility_column_content’, 20, 2 ); function huk_admin_products_visibility_column_content( $column, $product_id ){ if ( $column == ‘product_type’ ) { $product = wc_get_product( $product_id…Continue reading

Display Product Dimensions Data

add_action( ‘woocommerce_single_product_summary’, ‘display_product_formated_dimensions_table’, 25 ); function display_product_formated_dimensions_table(){ global $product; if ( $product->has_dimensions() ) { echo ‘ ‘ . __( ‘Dimensions’, ‘woocommerce’ ) . ‘ ‘ . esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ) . ‘ ‘; } }Continue reading