Editable Draft order
-
Hi.
I try to make order with status Draft editable.
It works with this code, but i get an error when i try to create a new order.
Is there anyone that can help me with this?
The code i use:function allow_product_addition_for_checkout_draft_orders($is_editable, $order) {
// Check if the order status is ‘status-checkout-draft’
if ($order->get_status() === ‘status-checkout-draft’) {
return true;
}
return $is_editable;
}
add_filter(‘woocommerce_order_items_meta_box_product_addable’, ‘allow_product_addition_for_checkout_draft_orders’, 10, 2);function make_checkout_draft_orders_fully_editable($order_statuses) {
$order_statuses[] = ‘status-checkout-draft’;
return $order_statuses;
}// Allow order item editing
add_filter(‘wc_order_is_editable’, ‘make_checkout_draft_orders_fully_editable’);
add_filter(‘woocommerce_order_items_meta_box_product_addable’, ‘make_checkout_draft_orders_fully_editable’);
add_filter(‘woocommerce_order_items_meta_box_editable’, ‘make_checkout_draft_orders_fully_editable’);
add_filter(‘woocommerce_payment_complete_order_status’, ‘make_checkout_draft_orders_fully_editable’);The error i get:
Fatal error: Uncaught Error: [] operator not supported for strings
in /home/birkvnvq/subli-no.birkvally.no/wp-content/plugins/code-snippets/php/snippet-ops.php(582) : eval()’d code on line 11Call stack:
make_checkout_draft_orders_fully_editable()
wp-includes/class-wp-hook.php:326WP_Hook::apply_filters()
wp-includes/plugin.php:205apply_filters()
wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:188WC_Order_Data_Store_CPT::update()
wp-content/plugins/woocommerce/includes/class-wc-data-store.php:196WC_Data_Store::update()
wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:212WC_Abstract_Order::save()
wp-content/plugins/woocommerce/includes/class-wc-order.php:252WC_Order::save()
wp-content/plugins/cost-of-goods-for-woocommerce/includes/class-alg-wc-cog-orders.php:1682Alg_WC_Cost_of_Goods_Orders::update_order_items_costs()
wp-content/plugins/cost-of-goods-for-woocommerce/includes/class-alg-wc-cog-orders.php:1033Alg_WC_Cost_of_Goods_Orders::save_cost_input_shop_order_save_post()
wp-includes/class-wp-hook.php:326WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:348WP_Hook::do_action()
wp-includes/plugin.php:517do_action()
wp-includes/post.php:4880wp_insert_post()
wp-admin/includes/post.php:766get_default_post_to_edit()
wp-admin/post-new.php:66
Status:
System Status Report
### WordPress Environment ### WordPress address (URL): [Redacted] Site address (URL): [Redacted] WC Version: 9.2.3 Legacy REST API Package Version: ? 1.0.4 Action Scheduler Version: ? 3.8.1 Log Directory Writable: ? WP Version: 6.6.1 WP Multisite: – WP Memory Limit: 1 GB WP Debug Mode: – WP Cron: ? Language: nb_NO External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 8.1.29 PHP Post Max Size: 2 GB PHP Time Limit: 1024 PHP Max Input Vars: 1000 cURL Version: 7.87.0 OpenSSL/1.1.1w SUHOSIN Installed: – MySQL Version: 8.0.39-cll-lve Max Upload Size: 2 GB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### [REDACTED] ### Post Type Counts ### acf-field: 1 acf-field-group: 1 adt_product_feed: 1 attachment: 2286 awdp_pt_rules: 1 blocks: 19 customize_changeset: 30 custom_css: 1 elementor_library: 1 featured_item: 1 frm_form_actions: 7 frm_styles: 1 ft_supplier: 5 gift4u_gallery: 2 gift4u_tmpl: 2 lws-wre-event: 6 lws-wre-pool: 1 mailpoet_page: 1 nav_menu_item: 113 oembed_cache: 1 page: 39 pf_feed_post_type: 1 post: 25 po_product_options: 5 product: 401 product_variation: 2922 rcbp-rule: 1 revision: 43 rm_content_editor: 1 shop_coupon: 93 shop_order: 1176 shop_order_refund: 7 site-review: 1 uni_cpo_option: 2 ur_pro_popup: 1 user_registration: 2 ux_template: 12 watermark: 1 wc_afrsm: 1 wc_product_table: 4 wc_whsm: 3 wishlist: 1 wpcf7_contact_form: 5 wp_global_styles: 1 wp_navigation: 1 wp_template: 1 zuserreg_data: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (73) ### Query Monitor: av John Blackbourn – 3.16.4 Hide Shipping Method For WooCommerce: av theDotstore – 1.5.0 Add Customer for WooCommerce: av Dan's Art – 1.9.0 Advanced Coupons for WooCommerce Free: av Rymera Web Co – 4.6.2 Advanced Coupons for WooCommerce Premium: av Rymera Web Co – 3.6.0.1 Avansert lokal henting for WooCommerce: av zorem – 1.6.5 Breadcrumb NavXT: av John Havlik – 7.3.1 Bring Fraktguiden for WooCommerce: av Cove AS – 1.10.10 Code Snippets: av Code Snippets Pro – 3.6.5.1 Coming Soon Badge for WooCommerce: av wpcentrics – 1.0.16 Kontaktskjema 7: av Takayuki Miyoshi – 5.9.8 Cost of Goods for WooCommerce: av WPFactory – 3.4.8 Sl? av oppbl?stheter for WordPress og WooCommerce: av Sl? av oppbl?stheter – 3.4.9 Drag and Drop Multiple File Upload - Contact Form 7: av Glen Don L. Mongaya – 1.3.8.2 Accessories for WooCommerce: av Forge12 Interactive GmbH – 1.42 Facebook for WooCommerce: av Facebook – 3.2.7 Facebook Messanger Live Chat: av Ibrahim Mohamed Abotaleb – 1.0.0 Flexible Shipping: av Octolize – 4.25.7 Google for WooCommerce: av WooCommerce – 2.8.4 Site Kit av Google: av Google – 1.134.0 In Stock Mailer for WooCommerce: av Frank Pagano – 2.1.1 Jetpack: av Automattic – 13.7 Collapse-O-Matic: av twinpictures baden03 – 1.8.5.8 Klarna Checkout for WooCommerce: av Klarna – 2.12.9 Klarna Order Management for WooCommerce: av klarna krokedil – 1.9.2 Loco oversettelse: av Tim Whitlock – 2.6.11 Login As Customer or User Pro: av wp-buy – 10.7 MailPoet Premium: av MailPoet – 5.0.0 MailPoet: av MailPoet – 5.0.2 Media Library Organizer: av Optimole – 1.6.5 Menu Option: av Tushar Kapdi – 1.1 Note Finder for WooCommerce: av Disable Bloat – 1.3 OnSale Page for WooCommerce: av wpgenie – 1.1.4 OneSignal Push Notifications: av OneSignal – 2.4.4 Payment Gateways by User Roles for WooCommerce: av Imaginate Solutions – 1.3.0 Ytelseslab: av Ytelsesgruppen i WordPress – 3.4.0 WooCommerce Barcode Generator Pro: av Sharabindu – 6.0.6 Product Bundles - Variation Bundles: av franticpsyx – 2.0.0 Product Configurator for WooCommerce: av Marc Lacroix – 1.3.6 Product Import Export for WooCommerce: av WebToffee – 2.4.5 ProTeria CloudConnect: av Krokedil AB – 1.7.2 PW WooCommerce Gift Cards Pro: av Pimwick LLC – 3.4 Rank Math SEO: av Rank Math – 1.0.226 Software License Manager: av Tips and Tricks HQ – 4.5.6 Super Progressive Web Apps: av SuperPWA – 2.2.30 Tawk.to Live Chat: av Tawkto – 0.8.5 Temporary Login Without Password: av StoreApps – 1.8.3 User Role Editor: av Vladimir Garagulya – 4.64.2 Avansert forsendelsessporing for WooCommerce: av zorem – 3.6.8 Product Attachment for WooCommerce: av theDotstore – 2.3.0 WPC Product Bundles for WooCommerce (Premium): av WPClever – 8.1.0 WPC Product Bundles for WooCommerce: av WPClever – 8.1.0 Category Discount Woocommerce: av QuanticEdge – 4.14 Product Feed PRO for WooCommerce: av AdTribes.io – 13.3.5.3 Stock Sync for WooCommerce Pro: av Lauri Karisola / WP Trio – 2.7.0 WooCommerce.com Update Manager: av Automattic – 1.0.3 Betal med Vipps og MobilePay for WooCommerce: av WP Hosting – 2.1.8 WooCommerce Legacy REST API: av WooCommerce – 1.0.4 PDF Invoices & Packing Slips for WooCommerce: av WP Overnight – 3.8.6 Woo Product Bundles: av Woo – 8.0.1 (oppdatering til versjon 8.0.2. er tilgjengelig) WooCommerce Shipping & Tax: av WooCommerce – 2.7.0 Stock Manager for WooCommerce: av StoreApps – 3.1.0 WooCommerce: av Automattic – 9.2.3 WeScan: av Jerry Tieben – 1.0.15 WP Crontrol: av John Blackbourn – 1.17.0 WP Mail Logging: av WP Mail Logging Team – 1.12.0 WP Rocket: av WP Media – 3.16.4 WP STAGING WordPress Backup Plugin - Backup Duplicator & Migration: av WP-STAGING WPStagingBackup – 3.8.4 WPC Price by User Role for WooCommerce (Premium): av WPClever – 2.1.4 WPC Price by User Role for WooCommerce: av WPClever – 2.1.5 Custom Product Tabs for WooCommerce: av Code Parrots – 1.8.5 YITH WooCommerce Subscription: av YITH – 3.9.0 YouBrand API Integration: av aruldev – 1.0.0 ### Inactive Plugins (6) ### Add-on Contact Form 7 - Mailpoet 3: av Tikweb – 1.3.21 Innozilla Per Product Shipping WooCommerce: av Innozilla – 1.0.4 Product Barcode Generator: av Sharabindu – 2.0.7 Wishlist for WooCommerce: av WebToffee – 2.1.0 WooCommerce Wholesale Prices: av Rymera Web Co – 2.2.0.2 WooCommerce Wholesale Prices Premium: av Rymera Web Co – 2.0.0.2 ### Dropin Plugins () ### advanced-cache.php: advanced-cache.php db.php: Query Monitor Database Class (Drop-in) object-cache.php: object-cache.php ### Must Use Plugins (1) ### WP STAGING Optimizer: av WP STAGING – 1.5.6 ### Settings ### Legacy API Enabled: ? Force SSL: – Currency: NOK (kr) Currency Position: left_space Thousand Separator: . Decimal Separator: , Number of Decimals: 2 Taxonomies: Product Types: bundle (bundle) external (external) giftcard (giftcard) grouped (grouped) pw gift card (pw-gift-card) simple (simple) variable (variable) woosb (woosb) yith_bundle (yith_bundle) 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: ? HPOS feature enabled: – Order datastore: WC_Order_Data_Store_CPT HPOS data sync enabled: – ### Logging ### Enabled: ? Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2 Retention period: 30 dager Level threshold: – Log directory size: 54 MB ### WC Pages ### Butikkbase: #6 - /butikk/ Handlekurv: #7 - /handlekurv/ - Contains the [woocommerce_cart] shortcode Til kassen: #8 - /kasse/ - Contains the [woocommerce_checkout] shortcode Min konto: #9 - /my-account/ Vilk?r og betingelser: #4043 - /kjopsbetingelser/ ### Theme ### Name: Subli.no Child Version: 3.0 Author URL: Child Theme: ? Parent Theme Name: Flatsome Parent Theme Version: 3.19.4 Parent Theme Author URL: https://uxthemes.com WooCommerce Support: ? ### Templates ### Overrides: flatsome/woocommerce/archive-product.php flatsome/woocommerce/cart/cart-empty.php flatsome/woocommerce/cart/cart-shipping.php flatsome/woocommerce/cart/cart.php flatsome/woocommerce/cart/mini-cart.php flatsome/woocommerce/checkout/form-checkout.php flatsome/woocommerce/checkout/form-coupon.php flatsome/woocommerce/checkout/order-received.php flatsome/woocommerce/checkout/terms.php flatsome/woocommerce/checkout/thankyou.php flatsome/woocommerce/content-product-cat.php flatsome/woocommerce/content-product.php flatsome/woocommerce/content-single-product.php flatsome/woocommerce/content-widget-product.php flatsome-child/woocommerce/emails/customer-completed-order.php flatsome/woocommerce/global/breadcrumb.php flatsome/woocommerce/global/quantity-input.php flatsome/woocommerce/global/wrapper-end.php flatsome/woocommerce/global/wrapper-start.php flatsome/woocommerce/loop/header.php flatsome/woocommerce/loop/loop-end.php flatsome/woocommerce/loop/loop-start.php flatsome/woocommerce/loop/pagination.php flatsome/woocommerce/loop/rating.php flatsome/woocommerce/loop/result-count.php flatsome/woocommerce/loop/sale-flash.php flatsome/woocommerce/myaccount/form-login.php flatsome/woocommerce/myaccount/navigation.php flatsome/woocommerce/notices/error.php flatsome/woocommerce/notices/notice.php flatsome/woocommerce/notices/success.php flatsome/woocommerce/product-searchform.php flatsome/woocommerce/single-product/photoswipe.php flatsome/woocommerce/single-product/price.php flatsome/woocommerce/single-product/product-image.php flatsome/woocommerce/single-product/product-thumbnails.php flatsome/woocommerce/single-product/rating.php flatsome/woocommerce/single-product/related.php flatsome/woocommerce/single-product/review.php flatsome/woocommerce/single-product/sale-flash.php flatsome/woocommerce/single-product/share.php flatsome/woocommerce/single-product/short-description.php flatsome/woocommerce/single-product/tabs/tabs.php flatsome/woocommerce/single-product/title.php flatsome/woocommerce/single-product/up-sells.php flatsome/woocommerce/single-product-reviews.php flatsome/woocommerce/single-product.php ### Pimwick Plugins ### PW WooCommerce Gift Cards Pro: License key: PW-639c392851072 Result: success Cached: 2024-08-28 ### MailPoet ### Sending Method: MailPoet Send all site's emails with: Default WordPress sending method Task Scheduler method: Action Scheduler Cron ping URL: https://subli.no?mailpoet_router&endpoint=cron_daemon&action=ping ### Product Bundles ### Database Version: 8.0.1 Loopback Test: ? Template Overrides: – ### Klarna Checkout Request Log ### 2024-08-19 14:54:42: KCO get order Response code: 404 Response message: Correlation ID: 2024-08-13 11:28:22: KCO get order Response code: 404 Response message: Correlation ID: 2024-07-06 19:43:40: KCO get order Response code: 404 Response message: Correlation ID: 2024-06-16 18:26:39: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"eca6dde2-6eb6-467b-b55f-d8c8df771356","service_version":"SNAPSHOT"} Correlation ID: eca6dde2-6eb6-467b-b55f-d8c8df771356 2024-06-16 18:23:10: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"965dff51-4743-459b-8d26-1a6e3f463fb8","service_version":"SNAPSHOT"} Correlation ID: 965dff51-4743-459b-8d26-1a6e3f463fb8 2024-03-17 12:00:30: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"0343835f-548e-4c0a-9c67-e0700d8ac991","service_version":"SNAPSHOT"} Correlation ID: 0343835f-548e-4c0a-9c67-e0700d8ac991 2024-03-17 11:58:12: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"3af355f9-7993-456e-ba93-bf2c69c54c14","service_version":"SNAPSHOT"} Correlation ID: 3af355f9-7993-456e-ba93-bf2c69c54c14 2024-03-17 11:57:53: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"b55235d9-5431-4925-bc85-df056f6516f5","service_version":"SNAPSHOT"} Correlation ID: b55235d9-5431-4925-bc85-df056f6516f5 2023-11-11 00:13:59: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"af9fac1f-7fd2-422e-ac75-0a980aa9e77f","service_version":"SNAPSHOT"} Correlation ID: af9fac1f-7fd2-422e-ac75-0a980aa9e77f 2023-10-28 09:19:25: KCO update order Response code: 403 Response message: {"error_code":"READ_ONLY_ORDER","error_messages":["Resource is read-only"],"correlation_id":"cd4128c3-7808-4a6e-b8b9-b8405ee0ce07","service_version":"SNAPSHOT"} Correlation ID: cd4128c3-7808-4a6e-b8b9-b8405ee0ce07 2023-10-02 07:00:37: KCO get order Response code: 404 Response message: Correlation ID: 2023-09-03 14:04:13: KCO get order Response code: 405 Response message: {"error_code":"HTTP_ERROR","error_messages":[""],"correlation_id":"6382e433-f17f-45b5-a398-ee96e37d758f","service_version":"SNAPSHOT"} Correlation ID: 6382e433-f17f-45b5-a398-ee96e37d758f 2023-06-22 14:38:57: KCO get order Response code: 404 Response message: Correlation ID: 2023-06-07 22:20:02: KCO get order Response code: 404 Response message: Correlation ID: 2023-06-07 22:19:29: KCO get order Response code: 404 Response message: Correlation ID: ### Admin ### Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customize-store customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks pattern-toolkit-full-composability product-custom-fields remote-inbox-notifications remote-free-extensions payment-gateway-suggestions printful shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page launch-your-store Disabled Features: experimental-blocks minified-js product-pre-publish-modal settings async-product-editor-category-field product-editor-template-system Daily Cron: ? Next scheduled: 2024-08-28 18:47:07 +02:00 Options: ? Notes: 49 Onboarding: completed ### Action Scheduler ### Complete: 37 074 Oldest: 2024-08-02 04:46:27 +0200 Newest: 2024-08-28 16:10:28 +0200 Pending: 12 Oldest: 2024-08-28 16:10:53 +0200 Newest: 2024-09-03 02:05:55 +0200 Failed: 1 397 Oldest: 2023-03-11 01:35:37 +0100 Newest: 2024-08-01 10:02:06 +0200 Canceled: 2 Oldest: 2024-07-30 19:58:18 +0200 Newest: 2024-08-21 12:38:13 +0200 ### Status report information ### Generated at: 2024-08-28 16:10:44 +02:00
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.