Kengi
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [WooCommerce] Issue with Duplicate Items in single orderSystem Status Report
### WordPress Environment ### WordPress address (URL): [Redacted] Site address (URL): [Redacted] WC Version: 9.4.3 Legacy REST API Package Version: 此網站並未安裝舊版 REST API 外掛程式。 Action Scheduler Version: ? 3.8.2 Log Directory Writable: ? WP Version: 6.7.1 WP Multisite: – WP Memory Limit: 768 MB WP Debug Mode: – WP Cron: – Language: zh_TW External object cache: ? ### Server Environment ### Server Info: Apache PHP Version: 8.2.26 PHP Post Max Size: 256 MB PHP Time Limit: 120 PHP Max Input Vars: 6000 cURL Version: 8.2.1 OpenSSL/3.1.4 SUHOSIN Installed: – MySQL Version: 8.0.39-30 Max Upload Size: 256 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### [REDACTED] ### Post Type Counts ### _op_receipt: 5 _op_register: 7 _op_warehouse: 7 acf-field: 17 acf-field-group: 7 acf-post-type: 1 acf-taxonomy: 2 adt_product_feed: 2 attachment: 2621 elementor_library: 60 elementor_snippet: 1 language_switcher: 4 mailpoet_page: 1 nav_menu_item: 76 ninja-table: 2 op_transaction: 412 op_z_report: 294 order_status: 1 page: 59 post: 340 product: 2166 product_variation: 48224 shop_coupon: 13 shop_order: 5017 shop_order_placehold: 1 shop_order_refund: 3 store_list: 8 uo-recipe: 1 uo-trigger: 1 wcpa_pt_forms: 1 wp_navigation: 2 wp_template: 2 wppb-roles-editor: 9 wppb-ul-cpt: 1 yith_wcan_preset: 3 yith-wcmbs-plan: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (50) ### Advanced Custom Fields Multilingual: 由 OnTheGoSystems – 2.1.4.2 Admin Columns Pro: 由 AdminColumns.com – 6.4.12 Advanced Custom Fields PRO: 由 WP Engine – 6.3.11 Custom Order Status Manager for WooCommerce: 由 Bright Plugins – 1.1.5 Elementor Pro 專業版: 由 Elementor.com – 3.25.4 Elementor: 由 Elementor.com – 3.25.10 Essential Addons for Elementor - Pro: 由 WPDeveloper – 6.0.9 Essential Addons for Elementor: 由 WPDeveloper – 6.0.11 GP Limit Dates: 由 Gravity Wiz – 1.1.25 Gravity Forms: 由 Gravity Forms – 2.8.0 Gravity Perks: 由 Gravity Wiz – 2.3.6 LoginPress: 由 LoginPress – 3.3.0 MailPoet Premium: 由 MailPoet – 5.4.0 MailPoet: 由 MailPoet – 5.4.2 Profile Builder Unlimited: 由 Cozmoslabs – 3.12.0 Profile Builder: 由 Cozmoslabs – 3.12.9 QFPay Secure Checkout for WooCommerce: 由 QFPay – 1.0.9 Speed Optimizer: 由 SiteGround – 7.7.2 ShipAny: 由 ShipAny – 1.1.62 WPML Multilingual CMS: 由 OnTheGoSystems – 4.6.14 Woocommerce Custom Product Addons (5.x.x): 由 Acowebs – 5.1.0 Checkout Field Editor and Manager for WooCommerce - Pro: 由 Acowebs – 4.0.0 WooCommerce Custom Payment Gateway Pro: 由 WPRuby – 2.9.0 WooCommerce Multilingual & Multicurrency: 由 OnTheGoSystems – 5.3.8 Woocommerce + Openpos + Adjust stock app: 由 [email protected] – 1.0 Wordpress Admin App for OpenPOS: 由 [email protected] – 1.1 Openpos - Force update pos stock: 由 [email protected] – 1.0 Woocommerce OpenPos Stock Transfer Management: 由 [email protected] – 1.6.4 Woocommerce OpenPos: 由 [email protected] – 7.1.1 PDF Invoices & Packing Slips for WooCommerce: 由 WP Overnight – 3.9.0 PDF Invoices & Packing Slips for WooCommerce - Premium Templates: 由 WP Overnight – 2.21.9 WooCommerce Product Variations Swatches Premium: 由 VillaTheme – 1.1.3 WooCommerce Sequential Order Numbers Pro Integrated With Openpos: 由 Vu Anh – 1.12.1 WooCommerce Sequential Order Numbers Pro: 由 SkyVerge – 1.21.3 WooCommerce Smart Coupons: 由 StoreApps – 9.12.0 (可更新為版本 9.19.1) WooCommerce: 由 Automattic – 9.4.3 Wordfence Security: 由 Wordfence – 8.0.1 Yoast SEO: 由 Yoast 團隊 – 24.0 WP All Export Pro: 由 Soflyy – 1.9.1 WP All Import Pro: 由 Soflyy – 4.9.4 WP-Optimize Premium - Clean, Compress, Cache: 由 David Anderson Ruhani Rabin Team Updraft – 3.6.0 Widgets for Google Reviews: 由 Trustindex.io – 12.4.6 WP All Export - User Export Add-On Pro: 由 Soflyy – 1.0.7 WP All Export - WooCommerce Export Add-On Pro: 由 Soflyy – 1.0.9 WP All Import - User Import Add-On Pro: 由 Soflyy – 1.1.8 WP All Import - WooCommerce Import Add-On Pro: 由 Soflyy – 4.0.0 WPML String Translation: 由 OnTheGoSystems – 3.2.15 YITH WooCommerce Ajax Product Filter Premium: 由 YITH – 5.3.0 YITH WooCommerce Customize My Account Page Premium: 由 YITH – 4.10.0 瀏覽「願望清單」: 由 YITH – 4.0.1 ### Inactive Plugins (16) ### OTGS Installer: 由 OnTheGoSystems – 3.1.3 Post Types Order: 由 Nsp Code – 2.3.3 Product Feed PRO for WooCommerce: 由 AdTribes.io – 13.3.9.1 Redirection: 由 John Godley – 5.5.0 Site Kit by Google: 由 Google – 1.140.0 Uncanny Automator: 由 Uncanny Automator Uncanny Owl – 6.0.0.1 Uncanny Automator Pro: 由 Uncanny Owl – 5.6 Woocommerce + openpos + YITH WooCommerce Points and Rewards Premium: 由 [email protected] – 1.1 Woocommerce OpenPos integrate with Woocommerce Custom Product Addons: 由 [email protected] – 2.0 Woocommerce Smart Coupon integrate with Openpos: 由 [email protected] – 1.0 WPGetAPI: 由 WPGetAPI – 2.2.9 WPGetAPI API to Posts: 由 WPGetAPI – 1.3.15 WPGetAPI PRO: 由 WPGetAPI – 3.5.8 YITH Core Framework: 由 YITH – 4.4.2 YITH WooCommerce Membership Premium: 由 YITH – 2.10.0 YITH WooCommerce Points and Rewards Premium: 由 YITH – 4.0.0 ### Dropin Plugins () ### object-cache.php: Memcached ### Settings ### Legacy API Enabled: – Force SSL: ? Currency: HKD ($) 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: – 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 day Level threshold: – Log directory size: 56 MB ### WC Pages ### 商店起點: #5 - https://diabond.com.hk/%e5%95%86%e5%ba%97/ 購物車: ? 頁面不包含 [woocommerce_cart] 短代碼或 woocommerce/cart 區塊。 結帳: ? 頁面不包含 [woocommerce_checkout] 短代碼或 woocommerce/checkout 區塊。 我的帳號: #8 - https://diabond.com.hk/my-account/ 服務條款: #41944 - https://diabond.com.hk/%e6%a2%9d%e6%ac%be%e5%92%8c%e6%a2%9d%e4%bb%b6/ ### Theme ### Name: diabond Version: 1.0.1700584202 Author URL: Child Theme: ? Parent Theme Name: Hello Elementor Parent Theme Version: 3.1.1 Parent Theme Author URL: https://elementor.com/?utm_source=wp-themes&utm_campaign=author-uri&utm_medium=wp-dash WooCommerce Support: ? ### Templates ### Overrides: /home/customer/www/diabond.com.hk/public_html/wp-content/plugins/profile-builder-unlimited/add-ons-advanced/woocommerce/templates/myaccount-edit-profile.php 的版本 7.0.1 已經過期。核心版本為 8.7.0 diabond/woocommerce/single-product/add-to-cart/grouped.php 的版本 - 已經過期。核心版本為 7.0.1 Outdated Templates: ? 了解如何更新 | 清除系統狀態佈景主題資訊快取 ### MailPoet ### Sending Method: PHPMail Send all site's emails with: Default WordPress sending method Task Scheduler method: Linux Cron Cron ping URL: https://diabond.com.hk/en/?mailpoet_router&endpoint=cron_daemon&action=ping ### 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: product-data-views experimental-blocks minified-js product-pre-publish-modal settings async-product-editor-category-field product-editor-template-system blueprint reactify-classic-payments-settings use-wp-horizon Daily Cron: ? Next scheduled: 2024-12-09 16:24:25 +08:00 Options: ? Notes: 48 Onboarding: skipped ### Action Scheduler ### 完成: 25,572 Oldest: 2024-11-08 22:33:24 +0800 Newest: 2024-12-09 22:18:37 +0800 Failed: 114 Oldest: 2024-05-02 19:54:24 +0800 Newest: 2024-12-02 18:27:00 +0800 Pending: 4 Oldest: 2024-12-10 08:41:48 +0800 Newest: 2024-12-11 11:45:37 +0800 ### Smart Coupons related settings ### ?* Number of coupons to show: 5 ?* Number of characters in auto-generated coupon code: ?* Valid order status for auto-generating coupon: Processing | Completed | Deposit ?* Automatic deletion: ? No ?* Coupon emails: ? Yes ?* Printing coupons: ? Yes ?* Sell gift cards at less price?: ? No ?* Use gift card applied in first subscription order for subsequent renewals until credit reaches zero: ? Yes ?* Renewal orders should not generate coupons even when they include a product that issues coupons: ? No ?* Allow sending of coupons to others: ? Yes ?* Allow schedule sending of coupons?: ?* Combine emails: ?* Auto generated coupon email: ? Yes ?* Combined auto generated coupons email: ? No ?* Acknowledgement email: ? Yes ?* Include tax in the amount of the generated gift card: ?* Deduct credit/gift before doing tax calculations: ? No ?* Gift Card discount is inclusive of tax: ? No ?* Enable taxes: ? No ?* Prices entered with tax: ? No ?* Display prices in the shop: ? Excl ?* Display prices during cart and checkout: ? Excl ?* Rounding: ? No ?* Display tax totals: Itemized ?* Enable the use of coupon codes: ? Yes ?* Calculate coupon discounts sequentially: ? No ?* Account endpoints > Coupons: wc-smart-coupons ?* WooCommerce Account Connected: ? No ### Status report information ### Generated at: 2024-12-09 22:53:31 +08:00
// Cache key for custom statuses
define('SNIL_CUSTOM_STATUSES_CACHE_KEY', 'snil_custom_paid_statuses_cache');
// Cache for custom statuses
function snil_get_custom_paid_statuses() {
$statuses = get_transient(SNIL_CUSTOM_STATUSES_CACHE_KEY);
if ($statuses === false) {
// Fetch custom order statuses based on meta query
$args = array(
'numberposts' => -1,
'post_type' => 'order_status',
'meta_query' => array(
array(
'key' => 'is_status_paid',
'compare' => '=',
'value' => '1',
),
),
);
$postStatusList = get_posts($args);
$statuses = array();
foreach ($postStatusList as $post) {
$slug = get_post_meta($post->ID, 'status_slug', true);
if ($slug) {
$statuses[] = sanitize_key($slug); // Sanitize slug for safety
}
}
// Cache the statuses for 12 hours
set_transient(SNIL_CUSTOM_STATUSES_CACHE_KEY, $statuses, 12 * HOUR_IN_SECONDS);
}
return $statuses;
}
// Dynamically add custom order statuses to WooCommerce reports
function snil_register_status_on_reports($statuses) {
if (!$statuses) {
$statuses = []; // Avoid PHP 8 warnings
}
// Get custom statuses from cache
$custom_statuses = snil_get_custom_paid_statuses();
// Merge custom statuses with existing ones
foreach ($custom_statuses as $slug) {
if (!in_array($slug, $statuses)) {
$statuses[] = $slug;
}
}
return $statuses;
}
add_filter('woocommerce_reports_order_statuses', 'snil_register_status_on_reports', 20, 1);
// Ensure refunds are handled correctly in WooCommerce reports
function snil_custom_woocommerce_reports_get_order_report_data_args($args) {
// Ensure refunds are included
$args['order_status'] = array_merge(
array('completed', 'processing', 'on-hold', 'refunded'),
snil_get_custom_paid_statuses() // Include custom statuses dynamically
);
return $args;
}
add_filter('woocommerce_reports_get_order_report_data_args', 'snil_custom_woocommerce_reports_get_order_report_data_args');
// Invalidate cache when a custom order status is created, updated, or deleted
function snil_invalidate_custom_statuses_cache($post_id) {
// Check if the post type is 'order_status'
if (get_post_type($post_id) === 'order_status') {
// Delete the transient to invalidate the cache
delete_transient(SNIL_CUSTOM_STATUSES_CACHE_KEY);
}
}
add_action('save_post', 'snil_invalidate_custom_statuses_cache');
add_action('delete_post', 'snil_invalidate_custom_statuses_cache');@luizbvplugins I’m tired of the above code; it only changes the report information, but it does not affect the analytics. ??
@luizbvplugins Thanks for your solution
The custom status now display in the standard reports (wc-reports) chart now
But its still not displaying on “analytics report”
tried Method 2 in theme support, not working ??
Parent Theme Name: Twenty Twenty
Viewing 4 replies - 1 through 4 (of 4 total)