Echo SKU in WooCommerce Conformation page [closed]
Have you tried: $productmeta = new WC_Product($id); $sku = $productmeta->post->sku; As seen here: Reference product SKU on WooCommerce confirmation page
Have you tried: $productmeta = new WC_Product($id); $sku = $productmeta->post->sku; As seen here: Reference product SKU on WooCommerce confirmation page
My suggestion would be to add in a simple flag that checks whether this is the initial time we’ve set our defaults, something such as below: function initial_product_data ( $post_id ) { // lets get out of here if this is not a new product if ( ‘product’ != $_POST[‘post_type’] ) return; //Grab our initial … Read more
I was frustrated by the same thing in WordPress. Check out my unanswered question: Content hooks vs User hooks I ended up getting around it by matching the user id and updating all the user fields regardless of whether they were updated. Until WordPress treats users’ hooks the same as posts’ hooks I think we’re … Read more
WooCommerce shows a listing of product categories at /products, which can be added to a menu as a simple link to that url. It took me a while to find that url. To override the categories page template, grab a copy of templates/content-product_cat.php from the WooCommerce repo and place it at woocommerce/content-product_cat.php in the child … Read more
What @ChipBennett meant is to show the actual code that is represented by the shortcode, it can be found in the source. Take a look at this to see what’s behind it – it is a WP_Query. Aside from that, the problem is – as far as I can tell – that you’re misinterpreting what … Read more
try this $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); // current term $parent_slug = ”; // default slug param if( $term->parent ){ // if current term has parent then get it’s slug $parent = get_term( $term->parent, get_query_var(‘taxonomy’) ); // term’s parent $parent_slug = $parent->slug; // slug of parent term } // … Read more
What you need to do is to compress the image. WordPress offers a filter to set the compression ratio. function my_jpg_compression($args) { return 75; } add_filter(‘jpeg_quality’, ‘my_jpg_compression’); NOTE: What you are returning is the compression ratio. 70-80% is manageable and you will not notice much reduced image quality. Also, after applying this filter only future … Read more
I had an error in the above code. $key used in both for loops. Working code for filtering empty product categories out of menu items: function exclude_empty_cat_menu_items( $items, $menu, $args ) { // Get a list of product categories that excludes empty categories $non_empty_categories = get_categories(array(‘taxonomy’ => ‘product_cat’)); // Iterate over the menu items foreach … Read more
WooCommerce uses a custom post type called product for its product. Your shop page appears to be looking for a products archive. I can tell this because of the slug – post-type-archive-product Have you tried renaming your custom shop template file archive-product.php? This should override the default archive template.
Just add another AND (&&) clause to the end of it. <?php if ( is_woocommerce_activated() && isset( $woo_options[‘woocommerce_header_cart_link’] ) && ‘true’ == $woo_options[‘woocommerce_header_cart_link’] && sizeof( $woocommerce->cart->cart_contents ) !== 0) {…} Probably best to take a look at some of the PHP tutorials or documentation around as you will be coming up against this type of … Read more