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

Display WooCommerce size product attribute on shop page

Your code is outdated since WooCommerce 3. First, you need to target variable products type only to avoid errors on other products types and also $product is already the product object. Also you can also directly use the WC_Product method get_attribute() and your code will be much more simpler, compact and efficient: add_action( ‘woocommerce_after_shop_loop_item_title’, ‘display_size_attribute’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)