notice

Custom cart notice based on user total purchased amount in Woocommerce

假如想象 提交于 2019-12-10 18:13:28
问题 I am trying to display a custom cart notice based on user total purchased amount in Woocommerce, based on this answer code: Add a percentage discount based on customer total purchases sum in Woocommerce It does not work as I would like. For example if a customer has made 2 orders: First order is 200 Second order is 122 So the total sum is 200 + 122 = 322. But I get a total of 200. What I am doing wrong? This is the code that I use: add_action( 'woocommerce_before_cart', 'vc' ); function vc( )

Change the position of of WooCommerce notices in storefront theme

送分小仙女□ 提交于 2019-12-08 05:22:28
问题 I am trying to change the position of storefront_shop_messages in my Storefront (WooCommerce) child theme. So I have added this code in the functions.php of my active theme: remove_action( 'storefront_content_top', 'storefront_shop_messages', 15 ); add_action('woocommerce_product_meta_end', 'storefront_shop_messages', 1 ); But it doesn't work. 回答1: The correct way to get what you are expecting in your comments (meaning displaying WooCommerce notices after add to cart button on product single

Different Messages Based on WooCommerce Page

≡放荡痞女 提交于 2019-12-08 04:07:19
问题 I am trying to alter messages displayed when adding an a product to cart and/ or updating the cart by hooking in to the woocommerce_add_message . It's not showing anything at all and I'm wondering why. I've tried echo and I've tried return__( Here's the code: add_filter('woocommerce_add_message', 'change_cart_message', 10); function change_cart_message() { $ncst = WC()->cart->subtotal; if ( is_checkout() ) { echo 'Your new order subtotal is: '.$ncst.'. <a style="color: green;" href="#customer

Different Messages Based on WooCommerce Page

一个人想着一个人 提交于 2019-12-06 16:54:39
I am trying to alter messages displayed when adding an a product to cart and/ or updating the cart by hooking in to the woocommerce_add_message . It's not showing anything at all and I'm wondering why. I've tried echo and I've tried return__( Here's the code: add_filter('woocommerce_add_message', 'change_cart_message', 10); function change_cart_message() { $ncst = WC()->cart->subtotal; if ( is_checkout() ) { echo 'Your new order subtotal is: '.$ncst.'. <a style="color: green;" href="#customer_details">Ready to checkout?</a>'; } elseif ( is_product() ) { echo 'Your new order subtotal is: '.

Can't get rid of PHP notices in mPDF

这一生的挚爱 提交于 2019-12-02 05:04:43
问题 I'm using the mPDF library to generate PDF docs directly from HTML output. The problem is that this mPDF library is written as it is and it is generating dozens of notices (undefined index, undefined offset, etc). I tried anything to stop outputting them but nothing yet helped. I tried to put error_reporting(E_ALL ^ E_NOTICE); as well as error_reporting(E_ALL & ~E_NOTICE); which i inserted into my index.php, into the class and method that is directly including mpdf.php and also at the start

Unset removed cart item notice on WooCommerce cart page

旧街凉风 提交于 2019-12-01 12:13:00
Is there a way to hide/remove the notice "Product removed. Undo?" on the cart page, when the customer removed the item from the cart? I tried: add_filter( 'woocommerce_cart_item_removed_title', '__return_null' ); but this only hides the title of the product, that has been removed... I couldn't find the right hook of the rest of the line ("removed" and "Undo?") To unset " {item_name} removed. Undo? " notice on cart page, you can trick Woocommerce with the following: add_action( 'template_redirect', 'null_removed_cart_item_message' ); function null_removed_cart_item_message() { // Only on cart

PHP How to fix Notice: Undefined variable: [duplicate]

故事扮演 提交于 2019-12-01 08:18:02
This question already has an answer here: Reference - What does this error mean in PHP? 34 answers code: Function ShowDataPatient($idURL) { $query =" select * from cmu_list_insurance,cmu_home,cmu_patient where cmu_home.home_id = (select home_id from cmu_patient where patient_hn like '%$idURL%') AND cmu_patient.patient_hn like '%$idURL%' AND cmu_list_insurance.patient_id like (select patient_id from cmu_patient where patient_hn like '%$idURL%') "; $result = pg_query($query) or die('Query failed: ' . pg_last_error()); while ($row = pg_fetch_array($result)) { $hn = $row["patient_hn"]; $pid = $row

PHP How to fix Notice: Undefined variable: [duplicate]

怎甘沉沦 提交于 2019-12-01 05:35:52
问题 This question already has answers here : Reference - What does this error mean in PHP? (34 answers) Closed 2 years ago . code: Function ShowDataPatient($idURL) { $query =" select * from cmu_list_insurance,cmu_home,cmu_patient where cmu_home.home_id = (select home_id from cmu_patient where patient_hn like '%$idURL%') AND cmu_patient.patient_hn like '%$idURL%' AND cmu_list_insurance.patient_id like (select patient_id from cmu_patient where patient_hn like '%$idURL%') "; $result = pg_query(

Is there a way to have Behat NOT fail on PHP Notice errors?

試著忘記壹切 提交于 2019-11-30 10:17:58
I understand that it is a best practice to have all variables defined and to check for array indexes before evaluating. However, I'm trying to run some tests on new functionalities developed on top of some legacy code which has not been coded this way. Behat fails with this message: Scenario: Add a new resource # features/accounting.feature:6 Given I am user "admin" # FeatureContext::iAmUser() Notice: Undefined index: 13 in classloader.php line 126 When I create a new resource # FeatureContext::iCreateANewResource() Then [...] I will fix these notices eventually, but I need Behat to ignore

Is it alright to suppress/hide PHP notices?

廉价感情. 提交于 2019-11-30 06:14:42
I've suppressed notices for quite some time with no problems whatsoever but I am beginning to wonder if I'm doing the right thing. I can't seem to find any logical reason why I shouldn't just suppress them but some other people seem to think that suppressing them using error_reporting is a horrible thing to do, but why? The closest thing to an answer I could find was in this question but that's still far from the answer I'm looking for. Is there some sort of unforeseen downside to hiding all the notices that PHP generates? For example, to include a variable from a POST call back into the form