woocommerce
WooCommerce – woocommerce_rest_cannot_view – Status 401
The 401 error you are getting is because you are using basic auth even though your website is not secure (does not have https). The solution in postman is to use OAuth 1.0. Just add the consumer key and consumer secret and send the request.
How to disable the quantity field in the product detail page in woocommerce?
Edit your product. Click “Inventory”. Check the box that says “Sold Individually”
How to get featured image of a product in woocommerce
I got the solution . I tried this . <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $product_id ), ‘single-post-thumbnail’ );?> <img src=”<?php echo $image[0]; ?>” data-id=”<?php echo $loop->post->ID; ?>”>
WooCommerce: Add product to cart with price override?
Here is the code for overriding price of product in cart add_action( ‘woocommerce_before_calculate_totals’, ‘add_custom_price’ ); function add_custom_price( $cart_object ) { $custom_price = 10; // This will be your custome price foreach ( $cart_object->cart_contents as $key => $value ) { $value[‘data’]->price = $custom_price; // for WooCommerce version 3+ use: // $value[‘data’]->set_price($custom_price); } } Hope it will … Read more
woocommerce get_woocommerce_currency_symbol()
Your code should work, which means the issue might be in the database. You can check these 2 functions:get_woocommerce_currency() and get_woocommerce_currency_symbol() from the WooCommerce docs that shows that you are using the functions correct. What is left is for you to start some troubleshooting steps to see what causes the error: What is get_option(‘woocommerce_currency’) returning? … Read more