WooCommerce

Hide add to cart for logged out visitors

start add_action( 'wp', 'jkpagency_hide_cart_logged_out' ); function jkpagency_hide_cart_logged_out () { if ( ! is_user_logged_in() ) { remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); } } end

Troubleshooting (debugging) a WooCommerce code

start https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/ // Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); next add_filter( 'woocommerce_product_tabs', 'jkpagency_debug_tabs' ); function jkpagency_debug_tabs( $tabs ) { // Debug tabs values error_log( 'This is wh...

Add single product Documentation tab

start add_filter( 'woocommerce_product_tabs', 'jkpagency_add_single_product_doc_tab' ); function jkpagency_add_single_product_doc_tab( $tabs ) { // Add single product Documentation tab $tabs['documentation'] = array( 'title' => __( 'Documentation', 'woocommerce' ), 'priority' => 19, 'callback' => 'doc_tab_content' ); return $tabs; } function doc_tab_content() { echo 'To download docs go follow this link.'; } end

Remove single product Reviews tab

start add_filter( 'woocommerce_product_tabs', 'jkpagency_remove_single_product_reviews_tab', 9999, 1 ); function jkpagency_remove_single_product_reviews_tab( $tabs ) { // Removes single product Reviews tab unset( $tabs['reviews'] ); return $tabs; } end

Remove all single product tabs

Start add_filter( 'woocommerce_product_tabs', 'jkpagency_remove_single_product_tab', 9999, 1 ); function jkpagency_remove_single_product_tab( $tabs ) { // Removes all single product tabs $tabs = array(); return $tabs; } end

How to Find Hooks

Hooks https://wordpress.org/plugins/hookmeup/ https://www.businessbloomer.com/category/woocommerce-tips/visual-hook-series/ end.

WooCommerce Email CSS

WooCommerce Email CSS More information below: https://www.businessbloomer.com/woocommerce-add-css-woocommerce-emails/ https://www.businessbloomer.com/woocommerce-add-extra-content-order-email/ end.

WooCommerce Hooks: Actions and filters

Actions are vital for customizing WooCommerce – if there were no actions, we would have had to edit the plugin core files. Instead, we can “hook” into each template and display custom stuff or run functions. WooCommerce Hooks: Actions and filters (https://woo.com/document/introduction-to-hooks-actions-and-filters/) Action and Filter Hook Reference (https://woocommerce.github.io/code-reference/hooks/hooks.html) WordPress Action Hooks (https://developer.wordpress.org/plugins/hooks/actions/) mo...

Shortcodes included with WooCommerce

Woo Shortcodes. https://woo.com/document/woocommerce-shortcodes/ woocommerce_cart – shows the cart page woocommerce_checkout – shows the checkout page woocommerce_my_account – shows the user account page woocommerce_order_tracking – shows the order tracking form

Code snippets plugin safe mode

If you would like to use the codes snippets plugin (https://wordpress.org/plugins/code-snippets/) & it still breaks your site, you can always add this snippet to wp-config.php. define('CODE_SNIPPETS_SAFE_MODE', true); This activates the plugin’s safe mode, enabling you to change/remove the snippet that broke the site instantly.

WooCommerce Notices - Product Single Template - Elementor Pro

Prerequisites - I have searched for similar features requests in both open and closed tickets and cannot find a duplicate. - The feature is still missing in the latest stable version of Elementor ( Elementor Pro. ) What problem is your feature request going to solve? Please describe. When designing a Single Product template in Elementor Pro, we are unable to specify where WooCommerce notices echo out to, how they look, or when they appear. We end up with all of the WooCommerce not...

Custom my account page trick

CSS code needed in order to hide navigation and make content part full width: .woocommerce-MyAccount-navigation { display:none; } .woocommerce-account .woocommerce-MyAccount-content { width: 100%; }