WP()->cart is null
-
In the cart, if not empty, have a form.
I want to save some addition message to cart for checkout form.
Sent form by ajaxfunction save_cart_options(){ //global $cart; //$cart->set_cart_contents($_POST); WP()->cart->set_cart_contents($_POST); wp_die(); }
This code return Fatal error because WP()->cart is null and global $cart is null. But Why??? I am logged in admin user, i have a products in cart. Why cart is null? Or i do something wrong.
NOTICE: WP()->cart and $cart is null on cart page too.
### WordPress Environment ### WordPress address (URL): https://min-boikot.1pls1.com Site address (URL): https://min-boikot.1pls1.com WC Version: 5.7.1 REST API Version: ? 5.7.1 WC Blocks Version: ? 5.7.2 Action Scheduler Version: ? 3.2.1 WC Admin Version: ? 2.6.5 Log Directory Writable: ? WP Version: ? 5.8 - There is a newer version of WordPress available (5.8.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.41 (Ubuntu) PHP Version: 7.3.30-1+ubuntu20.04.1+deb.sury.org+1 PHP Post Max Size: 20 MB PHP Time Limit: 60 PHP Max Input Vars: 1000 cURL Version: 7.68.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 5.5.5-10.3.31-MariaDB-0ubuntu0.20.04.1-log Max Upload Size: 20 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 5.7.1 WC Database Prefix: wp_ Total Database Size: 10.77MB Database Data Size: 7.76MB Database Index Size: 3.01MB wp_woocommerce_sessions: Data: 0.09MB + 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.08MB + Index: 0.09MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.05MB + 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.20MB + Index: 0.36MB + 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.19MB + Index: 0.14MB + Engine InnoDB wp_c2c_config: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.08MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_newsletter: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_newsletter_emails: Data: 0.03MB + Index: 0.00MB + Engine InnoDB wp_newsletter_sent: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_newsletter_stats: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_newsletter_user_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 2.02MB + Index: 0.16MB + Engine InnoDB wp_pmxi_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_hash: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_images: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_imports: Data: 0.17MB + Index: 0.00MB + Engine InnoDB wp_pmxi_posts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_pmxi_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_postmeta: Data: 2.23MB + Index: 0.70MB + Engine InnoDB wp_posts: Data: 1.23MB + Index: 0.22MB + Engine InnoDB wp_termmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.05MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.11MB + Index: 0.05MB + Engine InnoDB wp_term_taxonomy: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.14MB + Index: 0.09MB + 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_meta_lookup: Data: 0.05MB + Index: 0.09MB + 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_wt_iew_action_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wt_iew_cron: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wt_iew_ftp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wt_iew_mapping_template: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yith_wcwl: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yith_wcwl_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB ### Post Type Counts ### acf-field: 149 acf-field-group: 9 attachment: 322 awl-labels: 1 br_labels: 1 custom_css: 1 customize_changeset: 35 faq: 9 nav_menu_item: 35 page: 37 post: 22 product: 153 product_variation: 28 revision: 79 shop_coupon: 6 shop_order: 46 wpcf7_contact_form: 1 wpsl_stores: 3 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (23) ### Automated DHL Express live/manual shipping rates, labels and pickup: by HITShipo – 3.0.12 Automated FedEx live/manual rates with shipping labels.: by HITShipo – 3.1.2 Automated UPS Shipping: by HITShipo – 3.2.1 Advanced Custom Fields: Theme Code Pro: by hookturn – 2.4.0 Advanced Custom Fields PRO: by Delicious Brains – 5.10.2 Advanced Woo Labels: by ILLID – 1.30 FiboSearch - AJAX Search for WooCommerce: by FiboSearch Team – 1.13.0 Automated DHL Parcel shipping labels.: by HITShipo – 1.0.0 Automated USPS Shipping: by HITShipo – 1.0.1 Cart2cart: Shopify to Woocommerce Plugin: by MagneticOne – 2.0.0 Contact Form 7: by Takayuki Miyoshi – 5.4.2 PayPal Express Checkout Payment Gateway for WooCommerce ( Basic ): by WebToffee – 1.6.1 DHL Express for WooCommerce: by WP Desk – 1.5.1 Flexible Shipping UPS: by WP Desk – 1.15.1 Klarna Checkout for WooCommerce: by Krokedil – 2.6.1 Klarna Payments for WooCommerce: by krokedil klarna automattic – 2.6.0 Max Mega Menu: by megamenu.com – 2.9.4 Newsletter: by Stefano Lissa & The Newsletter Team – 7.2.7 PayPal PLUS for WooCommerce: by Inpsyde GmbH – 2.2.1 WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.3 WooCommerce: by Automattic – 5.7.1 WP SVG images: by KubiQ – 3.6 YITH WooCommerce Wishlist: by YITH – 3.1.1 ### Inactive Plugins (5) ### DHL for WooCommerce: by DHL – 2.6.0 Flexible Shipping For FedEx: by WP Desk – 1.6.0 Product Filters for WooCommerce: by Nexter – 1.1.16 USPS Simple Shipping for Woocommerce: by dangoodman – 1.5.6 WP Store Locator: by Tijmen Smit – 2.2.234 ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: Decimal Separator: . Number of Decimals: 0 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) 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: – ### WC Pages ### Shop base: #1347 - /shop/ Cart: #7 - /cart/ Checkout: #8 - /checkout/ My account: #9 - /my-account/ Terms and conditions: ? Page not set ### Theme ### Name: MIN NY Version: 1.0 Author URL: https://boikotyk.github.io/ 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: min/woocommerce/archive-product.php min/woocommerce/cart/cart-empty.php min/woocommerce/cart/cart-shipping.php min/woocommerce/cart/cart-totals.php min/woocommerce/cart/cart.php min/woocommerce/cart/proceed-to-checkout-button.php min/woocommerce/checkout/form-billing.php min/woocommerce/checkout/form-checkout.php min/woocommerce/checkout/form-coupon.php min/woocommerce/checkout/form-login.php min/woocommerce/checkout/payment-method.php min/woocommerce/checkout/payment.php min/woocommerce/checkout/review-order.php min/woocommerce/checkout/terms.php min/woocommerce/checkout/thankyou.php min/woocommerce/content-product.php min/woocommerce/content-single-product.php min/woocommerce/content-widget-product.php min/woocommerce/global/breadcrumb.php min/woocommerce/global/form-login.php min/woocommerce/global/quantity-input.php min/woocommerce/loop/add-to-cart.php min/woocommerce/loop/loop-end.php min/woocommerce/loop/loop-start.php min/woocommerce/loop/no-products-found.php min/woocommerce/loop/orderby.php min/woocommerce/loop/pagination.php min/woocommerce/loop/price.php min/woocommerce/loop/rating.php min/woocommerce/loop/result-count.php min/woocommerce/loop/sale-flash.php min/woocommerce/myaccount/dashboard.php min/woocommerce/myaccount/form-edit-account.php min/woocommerce/myaccount/form-login.php min/woocommerce/myaccount/form-lost-password.php min/woocommerce/myaccount/my-account.php min/woocommerce/myaccount/my-address.php min/woocommerce/myaccount/my-orders.php min/woocommerce/myaccount/navigation.php min/woocommerce/myaccount/orders.php min/woocommerce/myaccount/view-order.php min/woocommerce/single-product/add-to-cart/external.php min/woocommerce/single-product/add-to-cart/grouped.php min/woocommerce/single-product/add-to-cart/simple.php min/woocommerce/single-product/add-to-cart/variable.php min/woocommerce/single-product/add-to-cart/variation-add-to-cart-button.php min/woocommerce/single-product/add-to-cart/variation.php min/woocommerce/single-product/meta.php min/woocommerce/single-product/photoswipe.php min/woocommerce/single-product/price.php min/woocommerce/single-product/product-attributes.php min/woocommerce/single-product/product-image.php min/woocommerce/single-product/product-thumbnails.php min/woocommerce/single-product/rating.php min/woocommerce/single-product/related.php min/woocommerce/single-product/review-meta.php min/woocommerce/single-product/review-rating.php min/woocommerce/single-product/review.php min/woocommerce/single-product/sale-flash.php min/woocommerce/single-product/share.php min/woocommerce/single-product/short-description.php min/woocommerce/single-product/stock.php min/woocommerce/single-product/tabs/additional-information.php min/woocommerce/single-product/tabs/description.php min/woocommerce/single-product/tabs/tabs.php min/woocommerce/single-product/title.php min/woocommerce/single-product/up-sells.php min/woocommerce/single-product-reviews.php min/woocommerce/single-product.php ### Klarna Checkout Request Log ### No KCO errors: ### Klarna Payments Request Log ### 2021-09-29 17:46:26: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:46:26: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:46:22: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:46:21: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:46:20: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:58: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:58: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:58: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:58: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:56: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:56: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:56: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 17:45:56: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 15:49:32: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: 2021-09-29 15:49:32: KP Create Session Response code: 401 Response message: {"headers":[],"body":"<html>\r\n<head><title>401 Authorization Required<\/title><\/head>\r\n<body>\r\n<center><h1>401 Authorization Required<\/h1><\/center>\r\n<hr><center>openresty<\/center>\r\n<\/body>\r\n<\/html>\r\n","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Correlation ID: ### Action Scheduler ### Complete: 814 Oldest: 2021-09-03 09:18:31 +0000 Newest: 2021-09-30 04:42:16 +0000 ### Status report information ### Generated at: 2021-09-30 08:12:08 +00:00
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WP()->cart is null’ is closed to new replies.