wcs_is_subscription critical error
-
Hi there,
I’m trying to use the Subscription for WooCommerce plugin, which WebToffee created. But I have a critical error when I activate it with your WooCommerce Payments:
Fatal error: Cannot redeclare wcs_is_subscription() (previously declared in /Applications/MAMP/htdocs/goat/wp-content/plugins/xa-woocommerce-subscriptions/includes/class-hf-woocommerce-subscription.php:862) in /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/vendor/woocommerce/subscriptions-core/wcs-functions.php on line 40I talked with Webtoffee support, and they see that you didn’t validate the wcs_is_subscription function existence. Can you do it?
-
Hi @maitreart
Thanks for reaching out!
I understand that the Subscriptions for WooCommerce plugin is causing the conflict above in relation to the WooCommerce Payments plugin, is that correct?
I’d like to understand your site properly, can you please share your System Status Report, that will help us further troubleshoot.
You can find it via
WooCommerce > Status. SelectGet system reportand thenCopy for support. Once you’ve done that, you can paste it into your reply here.If you could also provide the fatal error logs (if any) under
WooCommerce > Status > Logs.Thanks!
Hi @xue28,
Yes, the Subscriptions for WooCommerce plugin causes a conflict with the WooCommerce Payments plugin. It happens because they also use
wcs_is_subscriptionfunction.Here is the status:
### WordPress Environment ### WordPress address (URL): http://localhost:8888/goat Site address (URL): http://localhost:8888/goat WC Version: 7.1.0 REST API Version: ✔ 7.1.0 WC Blocks Version: ✔ 8.7.5 Action Scheduler Version: ✔ 3.4.0 Log Directory Writable: ✔ WP Version: 6.1.1 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: Apache/2.4.46 (Unix) OpenSSL/1.0.2u PHP/8.0.8 mod_wsgi/3.5 Python/2.7.18 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.11 Perl/v5.30.1 PHP Version: 8.0.8 PHP Post Max Size: 8 MB PHP Time Limit: 30 PHP Max Input Vars: 1000 cURL Version: 7.68.0 OpenSSL/1.0.2u SUHOSIN Installed: – MySQL Version: 5.7.34 Max Upload Size: 8 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 7.1.0 WC Database Prefix: wp_ Total Database Size: 18.92MB Database Data Size: 15.18MB Database Index Size: 3.74MB wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_gmp_icons: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gmp_maps: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gmp_markers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gmp_marker_groups: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gmp_marker_groups_relation: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gmp_membership_presets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gmp_modules: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gmp_modules_type: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_gmp_options: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_gmp_options_categories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_gmp_usage_stat: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 3.02MB + Index: 0.06MB + Engine InnoDB wp_postmeta: Data: 2.52MB + Index: 1.97MB + Engine InnoDB wp_posts: Data: 8.31MB + Index: 0.28MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.05MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wpgmza: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_admin_notices: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_circles: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_image_overlays: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_maps: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_point_labels: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_polygon: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_polylines: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpgmza_rectangles: Data: 0.02MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### _themename-events: 2 _themename-products: 12 acf-field: 301 acf-field-group: 3 acfe-dbt: 1 attachment: 94 cpt_players: 11 custom_css: 1 customize_changeset: 3 gb_movies: 11 gutenberg_players: 5 heisler-events: 2 mc4wp-form: 1 nav_menu_item: 4 oembed_cache: 1 page: 30 players: 1 post: 7 revision: 963 wp_block: 1 wp_global_styles: 7 wpcf7_contact_form: 2 ### Security ### Secure connection (HTTPS): ❌ Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates. Hide errors from visitors: ❌Error messages should not be shown to visitors. ### Active Plugins (5) ### Contact Form 7: by Takayuki Miyoshi – 5.6.4 Dr Sonia Blocks: by GOAT Digital – 0.1.0 MC4WP: Mailchimp for WordPress: by ibericode – 4.8.11 WooCommerce Payments: by Automattic – 5.1.2 WooCommerce: by Automattic – 7.1.0 (update to version 7.1.1 is available) ### Inactive Plugins (17) ### ACF Medium Editor Field: by John A. Huebner II – 2.6.0 Advanced Custom Fields: Extended: by ACF Extended – 0.8.8.6 Advanced Custom Fields: Typography: by Reyhoun – 0.6.4 Advanced Custom Fields PRO: by Delicious Brains – 5.9.9 API KEY for Google Maps: by AyeCode Ltd – 1.2.3 Classic Editor: by WordPress Contributors – 1.6.2 Converter for Media: by Mateusz Gbiorczyk - Optimize Images by convert AVIF & WebP – 5.0.0 Duplicate Page: by mndpsingh287 – 4.4.8 GOAT.digital Blocks: by GOAT.digital team – 0.1.0 Heisler Events: by GOAT Digital – 1.0.0 Heisler Gutenberg Blocks: by GOAT Digital – 0.1.0 Heisler Meta: by The WordPress Contributors – 1.0.0 Hello Dolly: by Matt Mullenweg – 1.7.2 Mailchimp for WooCommerce: by Mailchimp – 2.7.6 Matej Gutenberg Blocks: by GOAT Digital – 0.1.0 Snazzy Maps: by Snazzy Maps – 1.4.0 Subscriptions for WooCommerce: by WebToffee – 3.2.6 ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: – Enforce Approved Product Download Directories: ✔ ### WC Pages ### Shop base: #4137 - /shop/ Cart: #4139 - /cart/ Checkout: #4141 - /checkout/ My account: #4143 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Twenty Twenty Version: 2.1 Author URL: https://wordpress.org/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: – ### Subscriptions ### WCS_DEBUG: ✔ No Subscriptions Mode: ✔ Live Subscriptions Live URL: http://localhost:8888/goat Subscription Statuses: – WooCommerce Account Connected: ❌ No ### Store Setup ### Country / State: United States (US) — Alabama ### Payment Gateway Support ### ### Admin ### Enabled Features: activity-panels analytics coupons customer-effort-score-tracks experimental-products-task experimental-import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing multichannel-marketing mobile-app-banner navigation onboarding onboarding-tasks remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page Disabled Features: minified-js new-product-management-experience settings Daily Cron: ✔ Next scheduled: 2022-12-08 13:40:45 +00:00 Options: ✔ Notes: 48 Onboarding: completed ### WooCommerce Payments ### Version: 5.1.2 Connected to WPCOM: No Blog ID: - Account ID: - ### Action Scheduler ### Complete: 21 Oldest: 2022-12-05 16:29:48 +0000 Newest: 2022-12-08 11:07:29 +0000 Pending: 2 Oldest: 2022-12-08 11:07:37 +0000 Newest: 2022-12-09 11:06:09 +0000 Failed: 1 Oldest: – Newest: – ### Status report information ### Generated at: 2022-12-08 11:07:40 +00:00Here are the logs:
2022-12-05T14:22:08+00:00 CRITICAL Uncaught TypeError: WCPay\Fraud_Prevention\Fraud_Prevention_Service::__construct(): Argument #1 ($session) must be of type WC_Session, null given, called in /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/includes/fraud-prevention/class-fraud-prevention-service.php on line 61 and defined in /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/includes/fraud-prevention/class-fraud-prevention-service.php:47 Stack trace: #0 /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/includes/fraud-prevention/class-fraud-prevention-service.php(61): WCPay\Fraud_Prevention\Fraud_Prevention_Service->__construct(NULL, Object(WCPay\Payment_Methods\CC_Payment_Gateway)) #1 /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/includes/class-wc-payments-blocks-payment-method.php(117): WCPay\Fraud_Prevention\Fraud_Prevention_Service::get_instance() #2 /Applications/MAMP/htdocs/goat/wp-includes/class-wp-hook.php(308): WC_Payments_Blocks_Payment_Method->maybe_add_card_testing_token('') #3 /Applications/MAMP/htdocs/goat/wp-includes/plugin.php(205): WP_Hook->apply_filters('', Array) #4 /Applications/MAMP/htdocs/goat/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1857): apply_filters('the_content', '') #5 /Applications/MAMP/htdocs/goat/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(568): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request)) #6 /Applications/MAMP/htdocs/goat/wp-includes/rest-api/class-wp-rest-server.php(1171): WP_REST_Posts_Controller->get_item(Object(WP_REST_Request)) #7 /Applications/MAMP/htdocs/goat/wp-includes/rest-api/class-wp-rest-server.php(1018): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages/(?...', Array, NULL) #8 /Applications/MAMP/htdocs/goat/wp-includes/rest-api.php(535): WP_REST_Server->dispatch(Object(WP_REST_Request)) #9 /Applications/MAMP/htdocs/goat/wp-includes/rest-api.php(2884): rest_do_request(Object(WP_REST_Request)) #10 [internal function]: rest_preload_api_request(Array, '/wp/v2/pages/41...') #11 /Applications/MAMP/htdocs/goat/wp-includes/block-editor.php(638): array_reduce(Array, 'rest_preload_ap...', Array) #12 /Applications/MAMP/htdocs/goat/wp-admin/edit-form-blocks.php(77): block_editor_rest_api_preload(Array, Object(WP_Block_Editor_Context)) #13 /Applications/MAMP/htdocs/goat/wp-admin/post.php(187): require('/Applications/M...') #14 {main} thrown in /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/includes/fraud-prevention/class-fraud-prevention-service.php on line 47 2022-12-05T19:09:30+00:00 CRITICAL Cannot redeclare wcs_is_subscription() (previously declared in /Applications/MAMP/htdocs/goat/wp-content/plugins/xa-woocommerce-subscriptionss/includes/class-hf-woocommerce-subscription.php:862) in /Applications/MAMP/htdocs/goat/wp-content/plugins/woocommerce-payments/vendor/woocommerce/subscriptions-core/wcs-functions.php on line 40Thanks in advance.
Hi @xue28, I hope you’re doing well.
Do you happen to have any updates about the request?Hi @maitreart
Thanks for sending the System Status Report as well as the error logs.
I checked the Github repository and found an open bug related to your issue here: https://github.com/Automattic/woocommerce-payments/issues/5127
I would suggest subscribing to the thread to keep posted for updates.
Thanks!
The topic ‘wcs_is_subscription critical error’ is closed to new replies.