MarketPress calculate wrong shipping tax

MarketPress is applying tax to shipping, even though the option to charge tax on shipping is unchecked.

http://take.ms/Zu7C0

Checking MarkePress settings from the database the proper values appear to be stored. I have re-saved product and tax settings, deleted old DB transients, optimized DB tables, cleared browser cache, prayed, pulled out hair. Yet still, tax gets applied to shipping.

http://take.ms/3hMcX

Can't update to MarketPress 3.2.7 due to a fatal error that seems related to php5.6. And I can't update to php7 because of some limitation on the hosting side.

  • Predrag Dubajic

    Hi jcnjr,

    Hope you're doing well :slight_smile:

    I did some tests on my installation with both 3.2.6 and 3.2.7 and it works fine there so this shouldn't be version related.

    I also tried switching to PHP 5.6 while 3.2.7 was active but I didn't see any fatal errors.
    Can you tell me what's the exact error that you are getting and on which page so we can investigate this part as well?

    As for the tax issue, could you provide us with cPanel access so we can dig deeper into this?
    You can send us your details using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question and the template below:

    Subject: "Attn: Predrag Dubajic"
    - Site login url
    - WordPress admin username
    - WordPress admin password
    - cPanel credentials (host/username/password)
    - Link back to this thread for reference
    - Any other relevant urls

    Best regards,
    Predrag

  • jcnjr

    Thank you Predrag Dubajic

    I will send details once I clear that with the client (this is not my site), and I review the staging site to confirm the same errors occur there.

    When running MP v3.27 on the live site at http://www.pieoneer.com the following errors occur atop every page of the site. After rolling back to v3.26 all errors disappear...

    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 391

    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 439

    Warning: array_keys() expects parameter 1 to be array, null given in /home/content/05/2571605/html/wp_pie/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 445

    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 439

    Warning: array_keys() expects parameter 1 to be array, null given in /home/content/05/2571605/html/wp_pie/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 445

    • Predrag Dubajic

      Hi jcnjr,

      Thanks for the additional info, I've checked the code and the warnings seem to be specific to Multisite but even when I test it on my multisite I'm not getting any warnings so I'm still unable to replicate it.

      I have uploaded 3.2.7 to your staging site so I could test it out there but since Ivan provided you with a patch for tax issue please test that out and let me know once you are done so I could proceed with testing 3.2.7 for these warnings.

      Best regards,
      Predrag

  • jcnjr

    Predrag Dubajic said:

    As for the tax issue...

    Hi Predrag, thanks for the help!

    I have confirmed our staging site has the exact same configuration and also encounters both the sales tax on shipping issue, and fatal errors upon attempted plugin update.

    Credentials have been sent, for both the staging site and live site. Please make any necessary critical changes on the staging site first and report back before modifying the live site.

    In summary, to replicate this issue:
    1. Add t-shirt product* to cart ($20)
    2. Estimated Tax: + $1.14 = $21.14
    3. Enter Shipping Address: +6.00 = $26.00 (+ $1.48 tax on total) = $27.48
    4. Total should be $27.14 (without tax on shipping)

    *Issue occurs on any product(s).

  • jcnjr

    Ivan & Predrag Dubajic
    Thank you for the prompt support!

    Regarding the tax issue - you can try to replace.../class-mp-coupons-addon.php

    After replacing this file with the patch on our staging site, the correct tax is being applied to the product only upon checkout. So that patch appears to fix the issue.

    The site is still running MP v.3.2.6. I would like to push this fix to the live site as soon as possible, but I will wait for feedback regarding the fatal errors to see if we can address that quickly too.

    I notice a "marketpress 2" folder in the staging site plugins directory, but don't know if this is any different from the currently available version 3.2.7 so I will wait to hear back before doing anything else.

    Thanks again!

  • Predrag Dubajic

    Hi jcnjr,

    That other folder was uploaded by me as I wanted to test the Warnings on 3.2.7 but since Ivan applied the patch in the meantime I decided to let it sit there until you check the patch.

    So I did the test now by activating 3.2.7 and debug log but didn't see any warnings on there.

    Is it possible for you to setup a staging site of you multisite since the functions showing in warnings are related to multisite and probably why I don't see them on current staging site?

    Best regards,
    Predrag

  • jcnjr

    Predrag Dubajic said

    ...I did the test now by activating 3.2.7 and debug log but didn't see any warnings on there.

    Please confirm what site you are referring to. I updated MP to v.3.2.7 on kitchen.pieoneer.com and the errors are clearly there. I then replaced the class-mp-coupons-addon.php patch, and they remain. See screenshot.
    FYI: I renamed your "marketpress_3.2.7" folder to "marketpress" to ensure that wasn't causing any issues. MP 3.2.7 is still activated, and includes Ivan's patch. The Warnings below* appear on every page of the site, with one in the Dashboard.

    Is it possible for you to setup a staging site of you multisite...

    No, this is not necessary. This staging site and the live site are both single WordPress installs (not multisite), so we need to resolve the issue going on here.

    *WARNINGS w/ MP v.3.2.7

    On Every page of site (front end):
    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 391

    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 439

    Warning: array_keys() expects parameter 1 to be array, null given in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 445

    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 439

    Warning: array_keys() expects parameter 1 to be array, null given in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/plugins/marketpress/includes/common/class-mp-cart.php on line 445

    In Dashboard:

    Warning: Invalid argument supplied for foreach() in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/plugins/marketpress_3.2.7/includes/common/class-mp-cart.php on line 391

  • Predrag Dubajic

    Hi jcnjr,

    I'm not sure what's going on here but neither me or my colleague I asked to check can't see these warnings:

    Could you grant support access to the site so I could check if it shows with that account since the one you sent us isn't the same as main admin?
    I mean, it's a PHP warning so it shouldn't make any difference but it's worth a shot because nothing I try shows the errors on my end.

    Best regards,
    Predrag

  • jcnjr

    Predrag Dubajic said:

    small patch for the class-mp-cart.php file and I added that to your staging site...Can you check it out now

    FYI: All the Marketpress warnings I previously reported are no longer displaying in the dashboard, nor on the front end pages of the site. So that patch did help do something.

    However...I am now seeing new theme related Notices on Single Product view pages - not at /store, product listing, cart or checkout pages

    Notice: Undefined offset: 0 in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/themes/pinnacle/templates/blog-post-header.php on line 24

    Notice: Trying to get property of non-object in /home/content/05/2571605/html/wp_pie_kitchen/wp-content/themes/pinnacle/templates/blog-post-header.php on line 26

    So, two steps forward, one step back...not sure why notices are displaying anyway, wait.

    EDIT: 'WP_DEBUG' was left set to true in wp-config. After returning setting to false, those Warnings also disappear. (Any thoughts on those are appreciated, but certainly not urgent if irrelevant to our MP issues.)

    So...to confirm: our staging site at kitchen.pieoneer.com is now running a custom version of Marketpress with two patches? "class-mp-cart.php" and "class-mp-coupons-addon.php" have been edited? Anything else? Just wondering if/when I should update the live site and with what exactly...

    Thank you for your continued help!

  • Predrag Dubajic

    Hi jcnjr,

    Both of those files we applied on your site will be part of the next plugin release so you can apply them on your live site as well until the update is released.

    As for those notices, well, I can finally see the same thing as you :slight_smile:
    However I did test your theme on my installation and I was unable to replicate the notices there.
    So I checked the code real quick and it seems that the header is trying to pull post title based on the category but for some reason it doesn't populate the values properly on product posts.

    Could you check this with the theme devs and check why this is happening on your installation?

    Note that these are only notices and they won't affect your site functionality in any way.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.