Skip to content
Advertisement

Tag: hook-woocommerce

Several issues when using woocommerce_get_availability hook

Im trying to show an ‘out of stock message’ on the single product page for products that are out of stock. I have this code in my functions.php I get the following error: Notice: stock was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/plugins/woocommerce/templates/single-product.php’), wc_get_template_part, load_template, require(‘/themes/mytheme/woocommerce/content-single-product.php’), do_action(‘woocommerce_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_single_add_to_cart, do_action(‘woocommerce_simple_add_to_cart’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_simple_add_to_cart,

wordpress redirect users to the same URL they request appending parameters according to role

I am working on a Wordpress website with multiple roles. My target is to redirect user with a specific role when they request pages like orders in the admin area to go to a filtered URL having their id. example: User requests: www.site.com/wp-admin/edit.php?post_type=shop_order This Applies only to the role “tester” My Approach was: Rewriting the code now gave me error,

Advertisement