Get woocommerce product price by id [closed]

You can create a product object using the following function: $product = wc_get_product( $post_id ); And after that you will be able to access to all product’s data. All available methods can be found here, but the ones you need are: $product->get_regular_price(); $product->get_sale_price(); $product->get_price();

How to Display Product specific to a category with WooCommerce Plugin? [closed]

You need to create a new loop for that. Here’s the code I use for displaying products from a specific category on the home page: <ul class=”products”> <?php $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 1, ‘product_cat’ => ‘shoes’, ‘orderby’ => ‘rand’ ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : … Read more

WooCommerce: change display order of product short description and price [closed]

If you look at woocommerce/templates/content-single-product.php you’ll see that the product summary is constructed using hooks with different priorities. Here’s the relevant section: <?php /** * woocommerce_single_product_summary hook * * @hooked woocommerce_template_single_title – 5 * @hooked woocommerce_template_single_rating – 10 * @hooked woocommerce_template_single_price – 10 * @hooked woocommerce_template_single_excerpt – 20 * @hooked woocommerce_template_single_add_to_cart – 30 * @hooked … Read more

Hide prices and checkout functionality in woocommerce

luckily woocommerce has many hooks, this removes prices and buttons: remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ ); remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 ); remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 ); remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 ); you can dig into content-product.php and content-single-product.php if you need to remove more stuff. I can imagine there’s more than just the prices/buttons you want to … Read more

get woocommerce My account page link

You can get the WooCommerce my-account URL as below <a href=”https://wordpress.stackexchange.com/questions/213612/<?php echo get_permalink( get_option(“woocommerce_myaccount_page_id’) ); ?>” title=”<?php _e(‘My Account’,”); ?>”><?php _e(‘My Account’,”); ?></a> Now you can insert this in completed order mail template too. <h2> <a href=”https://wordpress.stackexchange.com/questions/213612/<?php echo get_permalink( get_option(“woocommerce_myaccount_page_id’) ); ?>” title=”<?php _e(‘My Account’,”); ?>”>Go to your account page for review</a> </h2> <a href=”http://animax.cf/product/happy-ninja/#reviews”> … Read more

List of JS events in the WooCommerce frontend

On a hunt for the same I took a little dive into the JS source files. Woocommerce Javascript events Woocommerce Checkout JS events $( document.body ).trigger( ‘init_checkout’ ); $( document.body ).trigger( ‘payment_method_selected’ ); $( document.body ).trigger( ‘update_checkout’ ); $( document.body ).trigger( ‘updated_checkout’ ); $( document.body ).trigger( ‘checkout_error’ ); $( document.body ).trigger( ‘applied_coupon_in_checkout’ ); $( document.body … Read more

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