Provided solution here Remove a specific cart item when adding to cart a specific product in Woocommerce works perfect for one product id. Is any way to do this for multiple id’s? Answer Update 2 : The following code will work for multiple product IDs: Code goes in function.php file of your active child…
Tag: php
Laravel UUID’s and their uniqueness?
I have two tables, one for lists and another that stores a history of lists that were created. These lists are very temporary and they can be deleted by numerous methods so I add a reason field on the history for that. Now both have a uuid field and I can generate an actual string to store with Laravel’…
Add customer email and phone in “Order” column to admin orders list on Woocommerce
I am trying to find a way on how to add the customer phone and email below the name on the WooCommerce order view. See picture for reference where I need to add this information. Any ideas, tips or …
Preserve elements in each row of a two-dimensional array based on another array
I have this array: What I am looking for is a way to get a multiple array with only required columns (array_column is not a option, since it’s give me only 1 column). What I have done The problem is that it seems too laggy, since it iterates twice over this. Is there any way to get multiple columns with…
OSX composer increase memory limit
I am having memory issues with composer; trying to increase the available amount above 128MO. I have been following the guidelines from composer.org but nothing seems to work. If I locate php.ini on my machine I get: I sudo /private/etc/php.ini.default and change MEMORY_LIMIT = 512MO but when I do php -r R…
Group array rows by column value and create subarrays in each group
I have an array like the following: I would like it to be in the following format: so that each sub-array contains elements of the same date. Answer You can do this way.
Calculating tax using moneyphp
I am using the moneyphp/money class to store monetary values. However when calculating the tax owed I have an issue where the calculated tax is a decimal and the library is looking for an integerish …
How to ignore the specific CSS codes coming from the WordPress plugin stylesheet?
I am working on a WordPress website built on custom theme in which I want to ignore some specific CSS codes coming from wordpress plugin style sheet. Here is the link for that wordpress plugin style sheet. The CSS codes from the above WordPress plugin style sheet which I want to ignore is: Problem Statement: …
Filter out unwanted order item meta data from Woocommerce email notifications
In the order email templates (for example email-order-items.php), WooCommerce uses the function wc_display_item_meta to display product details in the order table. The function code is present in the wc-template-functions.php file (line number 3011). I am copying the function code below for reference The prob…
double data on mysql
I use the php operator && to select multiple data so that there is no duplication on mysql. Does the code that I use below run fine? Is there a more simple use of PHP operators? Answer Upgrade to mysqli, I’ll recommend object-oriented syntax because it is nicer to work with. In accordance with t…