• Receiving Fatal Error when creating/updating coupons using Store Credit via Marketing>Coupons. Please advise.

    Fatal error: Uncaught TypeError: GoDaddy\WordPress\MWC\Common\Models\Coupon::setAllowsFreeShipping(): Argument #1 ($value) must be of type bool, null given, called in /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/vendor/godaddy/mwc-common/src/DataSources/WooCommerce/Adapters/CouponAdapter.php on line 50 and defined in /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/vendor/godaddy/mwc-common/src/Models/Coupon.php:130 
    Stack trace: 
    #0 /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/vendor/godaddy/mwc-common/src/DataSources/WooCommerce/Adapters/CouponAdapter.php(50): GoDaddy\WordPress\MWC\Common\Models\Coupon->setAllowsFreeShipping(NULL) 
    #1 /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/src/WooCommerce/Adapters/CouponAdapter.php(30): GoDaddy\WordPress\MWC\Common\DataSources\WooCommerce\Adapters\CouponAdapter->convertFromSource() 
    #2 /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/src/WooCommerce/Interceptors/CouponInterceptor.php(111): GoDaddy\WordPress\MWC\Core\WooCommerce\Adapters\CouponAdapter->convertFromSource() 
    #3 /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/src/WooCommerce/Interceptors/CouponInterceptor.php(66): GoDaddy\WordPress\MWC\Core\WooCommerce\Interceptors\CouponInterceptor->getConvertedCoupon(Object(WC_Coupon)) 
    #4 /var/www/wp-includes/class-wp-hook.php(310): GoDaddy\WordPress\MWC\Core\WooCommerce\Interceptors\CouponInterceptor->onWooCommerceUpdateCoupon(1624) 
    #5 /var/www/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) 
    #6 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 
    #7 /var/www/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php(391): do_action('woocommerce_cou...', 1624, Object(WC_Coupon)) 
    #8 /var/www/wp-includes/class-wp-hook.php(308): WC_Meta_Box_Coupon_Data::save(1624, Object(WP_Post)) 
    #9 /var/www/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) 
    #10 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 
    #11 /var/www/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php(268): do_action('woocommerce_pro...', 1624, Object(WP_Post)) 
    #12 /var/www/wp-includes/class-wp-hook.php(310): WC_Admin_Meta_Boxes->save_meta_boxes(1624, Object(WP_Post)) 
    #13 /var/www/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) 
    #14 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) 
    #15 /var/www/wp-includes/post.php(4717): do_action('save_post', 1624, Object(WP_Post), true) 
    #16 /var/www/wp-includes/post.php(4819): wp_insert_post(Array, false, true) 
    #17 /var/www/wp-admin/includes/post.php(426): wp_update_post(Array) 
    #18 /var/www/wp-admin/post.php(227): edit_post() 
    #19 {main} thrown in /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/vendor/godaddy/mwc-common/src/Models/Coupon.php on line 130
    • This topic was modified 1 year, 7 months ago by 3djedi.
Viewing 1 replies (of 1 total)
  • Hey @3djedi . My name is Pit and I’m working with the team that is supporting the GoDaddy Managed WordPress platform. I stumbled onto this case and I think I can offer you further context as to why this may be happening.

    In short, our platform offers a custom WooCommerce experience with a bunch of integrates features that aren’t available to WooCommerce by default. In this case, our platform is trying to convert the native Coupon object to an object that is more compatible with our platform. However, the conversion process requires stricter value types for the free shipping option that is offered by WooCommerce.

    The Allow Free Shipping option that is offered when a new coupon is created seems to get hidden by the Store Credit / Gift cards for WooCommerce plugin and its value returned to “null” instead of true or false. Because our platform integration and the plugin both use the same core functionality (in this case, the filter named woocommerce_coupon_get_free_shipping ), the plugin returns a null value when our platform is expecting a true or false value.

    For similar cases, we usually recommend reaching out to the plugin developers to have a closer look and check if returning false instead of null is a better approach, but I’m afraid that for the time being there’s nothing we can do on our end to help.

    Let me know if you have any questions and I’d be happy to help answer them!

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal Error: Uncaught TypeErrror’ is closed to new replies.