I’ve been using the syntax Carbon::now()->startOfWeek() and Carbon::now()->endOfWeek() for awhile now. It returns the first day of the week which is the date of Monday and the last day of the …
Tag: php
file_get_html() not working in Google App Engine
I have some PHP code working perfectly in local and also in the web (with a non SSL hosting). I get file contents with file_get_html(url) and everything works OK. The problem comes when I try to run this code in Google App Engine. The function file_get_html() doesn’t work. The following code shows nothi…
Show SKU on cart and checkout pages in Woocommerce 3
I would like to display SKU on cart (Under product column ) and checkout page. I searched SO, but all answers are for old versions of WooCommerce and non of them is for 3.x. How can I show SKU on cart and checkout pages in Woocommerce 3? Answer 2021 Update You can do it with a custom unction hooked in
Nested shortcode to dynamically display WooCommerce products category
I am attempting to display a WooCommerce product category page based on the current user role. I have created a custom function get_user_role() to get the user role and added the shortcode [user_role]…
Displaying full product description on product lightbox
Is there a WooCommerce add_action to display the full product description, this is the text found in the main text edit window (not the Product short description) After a quick google search I was …
How to check if a Carbon date object is at the start of day?
I’m using Carbon to manipulate dates I retrieved from my MySQL database. I have dates like the following: 2017-07-19 00:00:00 2017-06-26 15:27:57 As you can see, the first is the start of a day. …
Convert associative array to indexed array with associative subarrays
I have a simple associative array with country data like this: How can I dynamically transform this array in a multiple array like: Answer Simply loop through it and create a new array from each key/value pair.
Unset product tabs for specific product categories in woocommerce
I am using the code coming from this answer: Hiding tabs only for some products in WooCommerce single product pages Here is that code: This code works fine to unset or hide tabs from specific products. Instead I would like to unset or hide tabs from specific product categories. How can I do it for product cat…
Conditionally add a subscription when product added to cart in WooCommerce 3
Hi Im looking for a code that adds my subscription ID (2282) to cart if there is added a normal product but NOT if the user is already subscriber. Feel free to ask questions. I’m in the GMT+1 time zone WordPress – 4.8.1 WooCommerce – 3.1.1 WooCommerce Subscriptions – 2.2.11 WooCommerce Membe…
Change product prices via a hook in WooCommerce 3+
IN WooCommerce, I need to multiply all product prices by a number. So I have used the following (via a plugin): But, that doesn’t work for variation products. I have tried the following hooks with no luck: The only one that works half way is this one: But that just changed the overall price, not the sel…