Fetch Product information in WooCommerce

Product Attributes without Variation Don’t Display in Shop page & Product Page Add Attribute and Variations in Product ( Refer blog ) Note : Product variations is Used Only Variable Product. And Then after put this code in function.php add_action( ‘woocommerce_after_shop_loop_item_title’, ‘bbloomer_echo_stock_variations_loop’ ); function bbloomer_echo_stock_variations_loop(){ global $product; if ( $product->get_type() == ‘variable’ ) { foreach … Read more

How do I add a text input field for customers to leave a note on a single WooCommerce product page?

The best way to extend WordPress and WooCommerce is by using hooks. To add custom option field on products area, you can use the following hooks: woocommerce_product_options_advanced: used to add a custom field into the Advanced Tab woocommerce_process_product_meta: used to save/update field data in the database On your functions.php, you can add the following code: … Read more

Custom Woocommerce image size [closed]

There’s a few options you can choose from whenever changing image sizes. Switching out the actual default WooCommerce images is more difficult than a normal WordPress install as they are ingrained with the plugin. Modify Related Product Image Sizes: I’ve tested this and it seems to work only on related products ( though I’m sure … Read more

Redirect woocommerce single-product page

As per this post (https://stackoverflow.com/questions/43621049/woocommerce-multiple-single-product-templates-using-single-product-php-to-redire) I would update your code to look like this: function so_43621049_template_include( $template ) { if ( is_singular(‘product’) ) { $template = plugin_dir_path( __FILE__ ).’woocommerce/single-product.php’; } return $template; } add_filter( ‘template_include’, ‘so_43621049_template_include’, 20 ); I haven’t had a chance to test this but I believe it will work.

Extend Woocommerce rest api routes fails

What if in your register_rest_route() call you can pass it the permission_callback option: ‘permission_callback’ => function () { return current_user_can(‘customer’); // OR return current_user_can(‘shop_manager’); } That way you are sure that you are dealing with a logged in Woocommerce user?? These are the two roles that Woocommerce is adding to your site. https://docs.woocommerce.com/document/roles-capabilities/ I know … Read more