How to check if is in cart page? [closed]

I’m not sure where are you hooking your function to, but you might be doing it too early. Hook to template_redirect, and then redirect the user: add_action(‘template_redirect’,’redirect_visitor’); function redirect_visitor(){ if ( is_page( ‘cart’ ) || is_cart() ) { wp_safe_redirect(site_url()); exit(); // Don’t forget this one } }

Are there any hook or filter when refund is done through admin -woocommerce

Although this answer is little late but anyone else may get benefit from it. The woocommerce_order_refunded hook is called when an order is refunded. Use the following example: // add the action add_action( ‘woocommerce_order_refunded’, ‘action_woocommerce_order_refunded’, 10, 2 ); // Do the magic function action_woocommerce_order_refunded( $order_id, $refund_id ) { // Your code here }

WP_Query: Exclude hidden products from WooCommerce product list

Important: The following only works for WooCommerce versions less than 3.0. For a more up-to-date answer please see the other answer by kalle. WooCommerce save this data as metadata so you’ll need to run a Meta Query against the name _visibility. Something like: ‘meta_query’ => array( array( ‘key’ => ‘_visibility’, ‘value’ => ‘hidden’, ‘compare’ => … Read more

Woocommerce get category image full size

Thanks to Mike Jolley (Woocommerce plugin author) for the solution using: wp_get_attachment_image_src $prod_categories = get_terms( ‘product_cat’, array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => true )); foreach( $prod_categories as $prod_cat ) : $cat_thumb_id = get_woocommerce_term_meta( $prod_cat->term_id, ‘thumbnail_id’, true ); $shop_catalog_img = wp_get_attachment_image_src( $cat_thumb_id, ‘shop_catalog’ ); $term_link = get_term_link( $prod_cat, ‘product_cat’ );?> <a href=”https://wordpress.stackexchange.com/questions/200170/<?php echo … Read more

How to add a new endpoint in woocommerce

seems woocommerce doesn’t have any filters when registering their endpoints, https://github.com/woothemes/woocommerce/blob/master/includes/class-wc-query.php#L84 so you need to add your new endpoint on init hooks, just like this add_action( ‘init’, ‘add_endpoint’ ); function add_endpoint(){ add_rewrite_endpoint( ‘license’, EP_ROOT | EP_PAGES ); } then you have to do some filtering on wc_get_template to call your files when the request match … Read more

How to get Woocommerce order product info

Have tried your code and it works fine and infact it also gives out the details of each product in the orders. The code which i tried $filters = array( ‘post_status’ => ‘any’, ‘post_type’ => ‘shop_order’, ‘posts_per_page’ => 200, ‘paged’ => 1, ‘orderby’ => ‘modified’, ‘order’ => ‘ASC’ ); $loop = new WP_Query($filters); while ($loop->have_posts()) … Read more

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