fluentcart-developer 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +26 -26
- package/README.md +59 -59
- package/dist/cards/fluentcart/templates-native.js +1087 -1087
- package/dist/cards/fluentcart/tools.js +2309 -2309
- package/dist/skills/fluentcart-developer/SKILL.md +108 -108
- package/dist/skills/fluentcart-developer/examples/README.md +30 -30
- package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
- package/dist/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
- package/dist/skills/fluentcart-developer/examples/sample-custom-addon/fluentcart-custom-addon.php +113 -113
- package/dist/skills/fluentcart-developer/examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php +148 -148
- package/dist/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
- package/dist/skills/fluentcart-developer/examples/sample-plugin-with-licensing-sdk/README.md +22 -22
- package/dist/skills/fluentcart-developer/examples/sample-plugin-with-licensing-sdk/sample-plugin-with-licensing-sdk.php +79 -79
- package/dist/skills/fluentcart-developer/examples/sample-plugin-with-licensing-sdk/updater/FluentLicensing.php +303 -303
- package/dist/skills/fluentcart-developer/examples/sample-plugin-with-licensing-sdk/updater/LicenseSettings.php +566 -566
- package/dist/skills/fluentcart-developer/examples/sample-plugin-with-licensing-sdk/updater/PluginUpdater.php +304 -304
- package/dist/skills/fluentcart-developer/examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php +61 -61
- package/dist/skills/fluentcart-developer/references/api/authentication.md +452 -452
- package/dist/skills/fluentcart-developer/references/api/coupons.md +786 -786
- package/dist/skills/fluentcart-developer/references/api/customers.md +889 -889
- package/dist/skills/fluentcart-developer/references/api/files.md +609 -609
- package/dist/skills/fluentcart-developer/references/api/index.md +432 -432
- package/dist/skills/fluentcart-developer/references/api/licensing.md +633 -633
- package/dist/skills/fluentcart-developer/references/api/order-bump.md +384 -384
- package/dist/skills/fluentcart-developer/references/api/orders.md +814 -814
- package/dist/skills/fluentcart-developer/references/api/products.md +866 -866
- package/dist/skills/fluentcart-developer/references/api/roles-permissions.md +536 -536
- package/dist/skills/fluentcart-developer/references/api/subscriptions.md +827 -827
- package/dist/skills/fluentcart-developer/references/database/index.md +44 -44
- package/dist/skills/fluentcart-developer/references/database/models/activity.md +178 -178
- package/dist/skills/fluentcart-developer/references/database/models/applied-coupon.md +291 -291
- package/dist/skills/fluentcart-developer/references/database/models/attribute-group.md +239 -239
- package/dist/skills/fluentcart-developer/references/database/models/attribute-relation.md +181 -181
- package/dist/skills/fluentcart-developer/references/database/models/attribute-term.md +219 -219
- package/dist/skills/fluentcart-developer/references/database/models/cart.md +645 -645
- package/dist/skills/fluentcart-developer/references/database/models/coupon.md +427 -427
- package/dist/skills/fluentcart-developer/references/database/models/customer-addresses.md +348 -348
- package/dist/skills/fluentcart-developer/references/database/models/customer-meta.md +156 -156
- package/dist/skills/fluentcart-developer/references/database/models/customer.md +584 -584
- package/dist/skills/fluentcart-developer/references/database/models/dynamic-model.md +163 -163
- package/dist/skills/fluentcart-developer/references/database/models/label-relationship.md +155 -155
- package/dist/skills/fluentcart-developer/references/database/models/label.md +153 -153
- package/dist/skills/fluentcart-developer/references/database/models/license-activation.md +182 -182
- package/dist/skills/fluentcart-developer/references/database/models/license-meta.md +163 -163
- package/dist/skills/fluentcart-developer/references/database/models/license-site.md +208 -208
- package/dist/skills/fluentcart-developer/references/database/models/license.md +640 -640
- package/dist/skills/fluentcart-developer/references/database/models/meta.md +233 -233
- package/dist/skills/fluentcart-developer/references/database/models/order-address.md +391 -391
- package/dist/skills/fluentcart-developer/references/database/models/order-download-permission.md +144 -144
- package/dist/skills/fluentcart-developer/references/database/models/order-item.md +383 -383
- package/dist/skills/fluentcart-developer/references/database/models/order-meta.md +303 -303
- package/dist/skills/fluentcart-developer/references/database/models/order-operation.md +158 -158
- package/dist/skills/fluentcart-developer/references/database/models/order-promotion-stat.md +175 -175
- package/dist/skills/fluentcart-developer/references/database/models/order-promotion.md +250 -250
- package/dist/skills/fluentcart-developer/references/database/models/order-tax-rate.md +172 -172
- package/dist/skills/fluentcart-developer/references/database/models/order-transaction.md +440 -440
- package/dist/skills/fluentcart-developer/references/database/models/order.md +727 -727
- package/dist/skills/fluentcart-developer/references/database/models/product-detail.md +397 -397
- package/dist/skills/fluentcart-developer/references/database/models/product-download.md +258 -258
- package/dist/skills/fluentcart-developer/references/database/models/product-meta.md +153 -153
- package/dist/skills/fluentcart-developer/references/database/models/product-variation.md +556 -556
- package/dist/skills/fluentcart-developer/references/database/models/product.md +580 -580
- package/dist/skills/fluentcart-developer/references/database/models/relationships.md +427 -427
- package/dist/skills/fluentcart-developer/references/database/models/scheduled-action.md +175 -175
- package/dist/skills/fluentcart-developer/references/database/models/shipping-class.md +148 -148
- package/dist/skills/fluentcart-developer/references/database/models/shipping-method.md +280 -280
- package/dist/skills/fluentcart-developer/references/database/models/shipping-zone.md +205 -205
- package/dist/skills/fluentcart-developer/references/database/models/subscription-meta.md +173 -173
- package/dist/skills/fluentcart-developer/references/database/models/subscription.md +528 -528
- package/dist/skills/fluentcart-developer/references/database/models/tax-class.md +195 -195
- package/dist/skills/fluentcart-developer/references/database/models/tax-rate.md +225 -225
- package/dist/skills/fluentcart-developer/references/database/models/user-meta.md +166 -166
- package/dist/skills/fluentcart-developer/references/database/models/user.md +220 -220
- package/dist/skills/fluentcart-developer/references/database/models.md +404 -404
- package/dist/skills/fluentcart-developer/references/database/query-builder.md +860 -860
- package/dist/skills/fluentcart-developer/references/database/readme.md +276 -276
- package/dist/skills/fluentcart-developer/references/database/schema.md +1002 -1002
- package/dist/skills/fluentcart-developer/references/engineering/adding-custom-pages-to-the-customer-dashboard.md +395 -395
- package/dist/skills/fluentcart-developer/references/engineering/index.md +4 -4
- package/dist/skills/fluentcart-developer/references/engineering.md +4 -4
- package/dist/skills/fluentcart-developer/references/getting-started.md +249 -249
- package/dist/skills/fluentcart-developer/references/guides/frontend.md +519 -519
- package/dist/skills/fluentcart-developer/references/guides/index.md +107 -107
- package/dist/skills/fluentcart-developer/references/guides/integrations.md +600 -600
- package/dist/skills/fluentcart-developer/references/guides/shipping-carrier/index.md +237 -237
- package/dist/skills/fluentcart-developer/references/guides/shipping-carrier/labels-and-tracking.md +481 -481
- package/dist/skills/fluentcart-developer/references/guides/shipping-carrier/live-rates.md +269 -269
- package/dist/skills/fluentcart-developer/references/guides/shipping-carrier/reference.md +223 -223
- package/dist/skills/fluentcart-developer/references/guides/shipping-carrier/settings.md +370 -370
- package/dist/skills/fluentcart-developer/references/guides/shipping-carrier.md +237 -237
- package/dist/skills/fluentcart-developer/references/guides/subscriptions.md +217 -217
- package/dist/skills/fluentcart-developer/references/hooks/actions/admin-and-templates.md +1079 -1079
- package/dist/skills/fluentcart-developer/references/hooks/actions/cart-and-checkout.md +1795 -1795
- package/dist/skills/fluentcart-developer/references/hooks/actions/customers-and-users.md +327 -327
- package/dist/skills/fluentcart-developer/references/hooks/actions/licenses.md +829 -829
- package/dist/skills/fluentcart-developer/references/hooks/actions/modules.md +81 -81
- package/dist/skills/fluentcart-developer/references/hooks/actions/orders.md +757 -757
- package/dist/skills/fluentcart-developer/references/hooks/actions/payments-and-integrations.md +1163 -1163
- package/dist/skills/fluentcart-developer/references/hooks/actions/pro-modules.md +219 -219
- package/dist/skills/fluentcart-developer/references/hooks/actions/products-and-coupons.md +1019 -1019
- package/dist/skills/fluentcart-developer/references/hooks/actions/subscriptions.md +1290 -1290
- package/dist/skills/fluentcart-developer/references/hooks/actions.md +16 -16
- package/dist/skills/fluentcart-developer/references/hooks/deprecated.md +60 -60
- package/dist/skills/fluentcart-developer/references/hooks/filters/cart-and-checkout.md +2032 -2032
- package/dist/skills/fluentcart-developer/references/hooks/filters/customers-and-subscriptions.md +1746 -1746
- package/dist/skills/fluentcart-developer/references/hooks/filters/integrations-and-advanced.md +2439 -2439
- package/dist/skills/fluentcart-developer/references/hooks/filters/modules.md +464 -464
- package/dist/skills/fluentcart-developer/references/hooks/filters/orders-and-payments.md +2658 -2658
- package/dist/skills/fluentcart-developer/references/hooks/filters/pro-modules.md +502 -502
- package/dist/skills/fluentcart-developer/references/hooks/filters/products-and-pricing.md +1785 -1785
- package/dist/skills/fluentcart-developer/references/hooks/filters/settings-and-configuration.md +2966 -2966
- package/dist/skills/fluentcart-developer/references/hooks/filters.md +14 -14
- package/dist/skills/fluentcart-developer/references/hooks/index.md +35 -35
- package/dist/skills/fluentcart-developer/references/index.md +625 -625
- package/dist/skills/fluentcart-developer/references/modules/fee-system.md +427 -427
- package/dist/skills/fluentcart-developer/references/modules/ghost-product-selling.md +440 -440
- package/dist/skills/fluentcart-developer/references/modules/index.md +484 -484
- package/dist/skills/fluentcart-developer/references/modules/licensing.md +342 -342
- package/dist/skills/fluentcart-developer/references/modules/order-bump.md +433 -433
- package/dist/skills/fluentcart-developer/references/modules/payment-methods.md +129 -129
- package/dist/skills/fluentcart-developer/references/modules/refunds.md +170 -170
- package/dist/skills/fluentcart-developer/references/modules/shipping.md +846 -846
- package/dist/skills/fluentcart-developer/references/modules/storage.md +986 -986
- package/dist/skills/fluentcart-developer/references/modules/subscription-vendor-ids.md +186 -186
- package/dist/skills/fluentcart-developer/references/modules/subscriptions.md +678 -678
- package/dist/skills/fluentcart-developer/references/payment-methods-integration/index.md +164 -164
- package/dist/skills/fluentcart-developer/references/payment-methods-integration/paddle-example.md +1648 -1648
- package/dist/skills/fluentcart-developer/references/payment-methods-integration/payment/setting/fields.md +353 -353
- package/dist/skills/fluentcart-developer/references/payment-methods-integration/quick-implementation.md +1079 -1079
- package/dist/skills/fluentcart-developer/references/payment-methods-integration.md +164 -164
- package/dist/skills/fluentcart-developer/references/restapi/checkout.md +573 -573
- package/dist/skills/fluentcart-developer/references/restapi/coupons.md +958 -958
- package/dist/skills/fluentcart-developer/references/restapi/customer-profile.md +1423 -1423
- package/dist/skills/fluentcart-developer/references/restapi/customers.md +1103 -1103
- package/dist/skills/fluentcart-developer/references/restapi/dashboard.md +1083 -1083
- package/dist/skills/fluentcart-developer/references/restapi/data-export.md +132 -132
- package/dist/skills/fluentcart-developer/references/restapi/email-notifications.md +846 -846
- package/dist/skills/fluentcart-developer/references/restapi/files.md +313 -313
- package/dist/skills/fluentcart-developer/references/restapi/index.md +127 -127
- package/dist/skills/fluentcart-developer/references/restapi/integrations.md +1000 -1000
- package/dist/skills/fluentcart-developer/references/restapi/inventory.md +192 -192
- package/dist/skills/fluentcart-developer/references/restapi/labels-and-attributes.md +797 -797
- package/dist/skills/fluentcart-developer/references/restapi/licensing.md +1733 -1733
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/get-available-shipping-methods.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/get-checkout-summary.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/get-country-info.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/get-order-info.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/get-shipping-methods-list-view.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/login.md +66 -66
- package/dist/skills/fluentcart-developer/references/restapi/operations/checkout/place-order.md +179 -179
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/apply-coupon.md +83 -83
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/cancel-coupon.md +87 -87
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/check-product-eligibility.md +59 -59
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/create-coupon.md +230 -230
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/delete-coupon.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/get-coupon-settings.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/get-coupon.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/list-coupon-codes.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/list-coupons.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/re-apply-coupons.md +75 -75
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/store-coupon-settings.md +40 -40
- package/dist/skills/fluentcart-developer/references/restapi/operations/coupons/update-coupon.md +133 -133
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/create-address-checkout.md +138 -138
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/create-profile-address.md +119 -119
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/dashboard-overview.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/delete-profile-address.md +46 -46
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/get-order-details.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/get-portal-sections.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/get-profile-details.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/get-transaction-billing-address.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/get-upgrade-paths.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/list-downloads.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/list-orders.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/make-profile-address-primary.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/pause-subscription.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/resume-subscription.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/save-transaction-billing-address.md +92 -92
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/select-address-for-checkout.md +32 -32
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/update-profile-address.md +115 -115
- package/dist/skills/fluentcart-developer/references/restapi/operations/customer-profile/update-profile-details.md +69 -69
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/attach-user.md +50 -50
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/bulk-actions.md +65 -65
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/create-address.md +135 -135
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/create-customer.md +108 -108
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/delete-address.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/detach-user.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/find-customer-order.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/get-attachable-users.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/get-customer-addresses.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/get-customer-orders.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/get-customer-stats.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/get-customer.md +32 -32
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/list-customers.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/recalculate-ltv.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/set-primary-address.md +72 -72
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/update-additional-info.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/update-address.md +144 -144
- package/dist/skills/fluentcart-developer/references/restapi/operations/customers/update-customer.md +123 -123
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/attach-note-to-order.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/create-all-pages.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/create-single-page.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/delete-activity.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-country-info.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-dashboard-stats.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-filter-options.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-onboarding-data.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-onboarding-settings.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-print-templates.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-search-options.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/get-widgets.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/initialize-app.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/list-activities.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/list-attachments.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/list-countries.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/mark-activity-read.md +53 -53
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/run-data-backfills.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/save-onboarding-settings.md +54 -54
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/save-onboarding-tax-settings.md +73 -73
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/save-print-templates.md +64 -64
- package/dist/skills/fluentcart-developer/references/restapi/operations/dashboard/upload-attachment.md +42 -42
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/export-customers-batch.md +129 -129
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/export-licenses-batch.md +133 -133
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/export-orders-batch.md +129 -129
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/export-subscriptions-batch.md +129 -129
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/get-customers-export-schema.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/get-licenses-export-schema.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/get-orders-export-schema.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/data-export/get-subscriptions-export-schema.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/enable-notification.md +57 -57
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/get-digest-settings.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/get-notification.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/get-reminders.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/get-settings.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/get-shortcodes.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/list-notifications.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/preview-default-template.md +66 -66
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/preview-notification.md +50 -50
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/save-digest-settings.md +101 -101
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/save-reminders.md +162 -162
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/save-settings.md +99 -99
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/send-digest-test.md +47 -47
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/send-manual-reminder.md +51 -51
- package/dist/skills/fluentcart-developer/references/restapi/operations/email-notification/update-notification.md +93 -93
- package/dist/skills/fluentcart-developer/references/restapi/operations/files/delete-file.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/files/get-bucket-list.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/files/list-files.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/files/upload-editor-file.md +32 -32
- package/dist/skills/fluentcart-developer/references/restapi/operations/files/upload-file.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/chained-data-request.md +46 -46
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/change-feed-status.md +51 -51
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/delete-feed.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/get-dynamic-options.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/get-feed-lists.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/get-feed-settings.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/get-global-feeds.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/get-global-settings.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/install-addon-plugin.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/list-addons.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/save-feed-settings.md +52 -52
- package/dist/skills/fluentcart-developer/references/restapi/operations/integration/set-global-settings.md +50 -50
- package/dist/skills/fluentcart-developer/references/restapi/operations/inventory/bulk-update-stock.md +94 -94
- package/dist/skills/fluentcart-developer/references/restapi/operations/inventory/export-inventory.md +81 -81
- package/dist/skills/fluentcart-developer/references/restapi/operations/inventory/get-adjustment-history.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/inventory/get-inventory-stats.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/inventory/list-inventory.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/inventory/update-stock.md +75 -75
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/create-attribute-group.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/create-label.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/create-terms.md +90 -90
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/delete-attribute-group.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/delete-attribute-term.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/get-attribute-group.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/get-attribute-library.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/list-attribute-groups.md +32 -32
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/list-attribute-terms.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/list-labels.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/reorder-groups.md +51 -51
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/reorder-terms.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/update-attribute-group.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/update-attribute-term.md +39 -39
- package/dist/skills/fluentcart-developer/references/restapi/operations/labels-attributes/update-label-selections.md +32 -32
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/activate-plugin-license.md +41 -41
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/activate-site-admin.md +60 -60
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/deactivate-plugin-license.md +18 -18
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/deactivate-site-admin.md +67 -67
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/deactivate-site-customer.md +47 -47
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/delete-license.md +24 -24
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/extend-license-validity.md +47 -47
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-customer-license-details.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-customer-licenses-admin.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-license-activations.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-license-details.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-license-site.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-plugin-license-status.md +18 -18
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/get-product-license-settings.md +24 -24
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/list-customer-licenses.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/list-license-sites.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/list-licenses.md +38 -38
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/public-activate-license.md +54 -54
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/public-check-license.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/public-deactivate-license.md +46 -46
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/public-download-license-package.md +23 -23
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/public-get-license-version.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/regenerate-license-key.md +24 -24
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/save-product-license-settings.md +193 -193
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/update-license-activation-limit.md +53 -53
- package/dist/skills/fluentcart-developer/references/restapi/operations/licensing/update-license-status.md +52 -52
- package/dist/skills/fluentcart-developer/references/restapi/operations/order-bumps/create-order-bump.md +47 -47
- package/dist/skills/fluentcart-developer/references/restapi/operations/order-bumps/delete-order-bump.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/order-bumps/get-order-bump.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/order-bumps/list-order-bumps.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/order-bumps/update-order-bump.md +141 -141
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/accept-dispute.md +47 -47
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/bulk-actions.md +72 -72
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/calculate-shipping.md +67 -67
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/calculate-tax.md +98 -98
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/change-customer.md +50 -50
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/charge-now.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/create-and-change-customer.md +92 -92
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/create-custom-order-item.md +68 -68
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/create-order.md +351 -351
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/create-renewal-now.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/delete-order.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/generate-missing-licenses.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/get-order-transactions.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/get-order.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/get-renewal.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/get-shipping-methods.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/get-single-transaction.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/list-order-currencies.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/list-orders.md +42 -42
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/list-renewals.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/mark-as-paid.md +61 -61
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/price-order.md +135 -135
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/refund-order.md +72 -72
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/resend-renewal-invoice.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/skip-renewal.md +48 -48
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/sync-order-statuses.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/sync-pending-transaction.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/update-order-address-id.md +60 -60
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/update-order-address.md +98 -98
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/update-order.md +172 -172
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/update-statuses.md +77 -77
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/update-subscription-details.md +84 -84
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/update-transaction-status.md +51 -51
- package/dist/skills/fluentcart-developer/references/restapi/operations/orders/void-renewal.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/create-pdf-template.md +42 -42
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/delete-pdf-template.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/download-pdf-preview.md +44 -44
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/get-factory-default-templates.md +19 -19
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/get-pdf-status.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/get-pdf-template.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/get-saved-templates.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/get-seller-details.md +19 -19
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/list-pdf-templates.md +19 -19
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/save-pdf-template.md +53 -53
- package/dist/skills/fluentcart-developer/references/restapi/operations/pdf-templates/save-seller-details.md +97 -97
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/add-product-terms.md +64 -64
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/bulk-edit-fetch.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/bulk-insert-products.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/bulk-update-products.md +59 -59
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/bulk-update-variants.md +83 -83
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/change-integration-status.md +64 -64
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/create-dummy-products.md +45 -45
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/create-product.md +81 -81
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/create-variation.md +181 -181
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/delete-downloadable-file.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/delete-product-integration.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/delete-product.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/delete-taxonomy-term.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/delete-upgrade-path.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/delete-variation.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/do-bulk-action.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/duplicate-product.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/fetch-products-by-ids.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/fetch-taxonomy-terms.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/fetch-terms-by-parent.md +60 -60
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/fetch-variations-by-ids.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/find-subscription-variants.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-bundle-info.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-downloadable-url.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-max-excerpt-word-count.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-pricing-widgets.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-product-integration-feeds.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-product-integration-settings.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-product-pricing.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-product.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-related-products.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-upgrade-settings.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/get-variation-upgrade-paths.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/group-bulk-update-variants.md +103 -103
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/list-all-variants.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/list-product-variations.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/list-products.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/remove-shipping-class.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/remove-tax-class.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/save-bundle-info.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/save-product-integration.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/save-upgrade-path.md +78 -78
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/search-product-variant-options.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/search-products-by-name.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/search-variants-by-name.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/set-variation-media.md +74 -74
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/suggest-sku.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/sync-downloadable-files.md +134 -134
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/sync-taxonomy-terms.md +61 -61
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/toggle-product-tax-exemption.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-downloadable-file.md +98 -98
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-inventory.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-long-desc-editor-mode.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-manage-stock.md +53 -53
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-product-detail.md +58 -58
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-product-pricing.md +225 -225
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-shipping-class.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-tax-class.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-upgrade-path.md +78 -78
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-variant-option.md +79 -79
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-variant-tax-exemption.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-variation-pricing-table.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/products/update-variation.md +105 -105
- package/dist/skills/fluentcart-developer/references/restapi/operations/public-shop/get-product-views.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/public-shop/list-products.md +42 -42
- package/dist/skills/fluentcart-developer/references/restapi/operations/public-shop/search-products.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/channel-rules.md +24 -24
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/country-heat-map.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/coupon-overview.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/coupons.md +36 -36
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/customer-insights.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/customer-overview.md +36 -36
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/customer-repeat.md +35 -35
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/customer-segment-customers.md +36 -36
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/customer-segments.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/customer-value.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/dashboard-stats.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/failed-orders.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/fetch-new-vs-returning-customer.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/fetch-report-by-day-and-hour.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/fetch-report-meta.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/fetch-top-sold-products.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/future-renewals.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/generate-retention-snapshots.md +24 -24
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/get-overview.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/get-recent-activities.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/get-recent-orders.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/get-revenue.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/installments-at-risk.md +35 -35
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/installments-variations.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/installments.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/item-count-distribution.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/license-chart.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/license-pie-chart.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/license-summary.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/locations.md +43 -43
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/order-chart.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/order-completion-time.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/order-mix.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/order-value-distribution.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/payment-methods-disputes.md +38 -38
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/payment-methods-methods.md +36 -36
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/payment-methods.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/product-comparison-launch.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/product-comparison.md +40 -40
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/product-detail.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/product-sales.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/refunds-overview.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/retention-snapshots-step.md +45 -45
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/sales-growth-chart.md +35 -35
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/save-channel-rules.md +73 -73
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/source-channels.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/sources.md +49 -49
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/subscription-cohorts.md +33 -33
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/subscription-health.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/subscription-rebuys.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/subscription-retention.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/subscription-variations.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/subscriptions-overview.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/reports/weeks-between-refund.md +34 -34
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/assign-role.md +48 -48
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/delete-role-assignment.md +47 -47
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/get-role.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/list-managers.md +18 -18
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/list-roles.md +18 -18
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/search-users.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/roles-permissions/update-role.md +43 -43
- package/dist/skills/fluentcart-developer/references/restapi/operations/saved-views/create-saved-view.md +106 -106
- package/dist/skills/fluentcart-developer/references/restapi/operations/saved-views/delete-saved-view.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/saved-views/list-saved-views.md +25 -25
- package/dist/skills/fluentcart-developer/references/restapi/operations/saved-views/update-saved-view.md +83 -83
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/activate-payment-addon.md +44 -44
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/activate-plugin-addon.md +44 -44
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/change-storage-driver-status.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/check-paypal-webhook.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/create-storage-bucket.md +63 -63
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/disconnect-payment-method.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/exchange-paypal-seller-auth-token.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-active-storage-drivers.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-checkout-fields.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-email-shortcodes.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-mcp-config-snippets.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-mcp-status.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-module-settings.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-payment-method-connection-info.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-payment-method-settings.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-permissions.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-plugin-addons.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-storage-driver-settings.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/get-store-settings.md +26 -26
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/install-mcp-adapter.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/install-payment-addon.md +60 -60
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/install-plugin-addon.md +64 -64
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/list-all-payment-methods.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/list-all-storage-drivers.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/list-storage-buckets.md +67 -67
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/reorder-payment-methods.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/reset-storage-driver-settings.md +45 -45
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-checkout-fields.md +133 -133
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-confirmation-settings.md +68 -68
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-module-settings.md +68 -68
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-payment-method-design.md +67 -67
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-payment-method-settings.md +58 -58
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-permissions.md +68 -68
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-storage-driver-settings.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/save-store-settings.md +239 -239
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/setup-paypal-webhook.md +48 -48
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/toggle-mcp.md +40 -40
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/verify-storage-driver-connection.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/settings/verify-turnstile-keys.md +55 -55
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/create-shipping-class.md +73 -73
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/create-shipping-method.md +110 -110
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/create-shipping-zone.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/delete-shipping-class.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/delete-shipping-method.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/delete-shipping-zone.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/get-shipping-class-profile.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/get-shipping-class.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/get-shipping-packages.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/get-shipping-zone.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/get-zone-countries.md +22 -22
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/get-zone-states.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/list-shipping-classes.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/list-shipping-zones.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/save-shipping-packages.md +112 -112
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/update-shipping-class.md +79 -79
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/update-shipping-method.md +113 -113
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/update-shipping-zone.md +62 -62
- package/dist/skills/fluentcart-developer/references/restapi/operations/shipping/update-zone-order.md +52 -52
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/cancel-auto-renew.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/cancel-subscription.md +52 -52
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/confirm-subscription-switch.md +70 -70
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/fetch-subscription-remote.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/generate-early-payment-link.md +29 -29
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/get-customer-subscription.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/get-or-create-plan.md +69 -69
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/get-setup-intent-attempts.md +30 -30
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/get-subscription.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/initiate-early-payment.md +31 -31
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/list-customer-subscriptions.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/list-subscriptions.md +39 -39
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/pause-subscription.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/reactivate-subscription.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/resume-subscription.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/switch-payment-method.md +70 -70
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/update-payment-method.md +69 -69
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/update-vendor-ids.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/subscriptions/verify-vendor-ids.md +56 -56
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/create-tax-class.md +51 -51
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/create-tax-rate.md +117 -117
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/delete-product-override.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/delete-shipping-tax-override.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/delete-tax-class.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/delete-tax-rate.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-country-tax-id.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-country-tax-rates.md +28 -28
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-eu-vat-product-overrides.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-oss-country-rates.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-preconfigured-tax-rates.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-product-overrides.md +27 -27
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/get-tax-settings.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/list-all-tax-rates.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/list-tax-classes.md +20 -20
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/list-tax-records.md +37 -37
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/mark-taxes-as-filed.md +58 -58
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/reset-eu-vat-rates.md +21 -21
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-configured-countries.md +57 -57
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-country-tax-id.md +50 -50
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-eu-vat-cross-border-settings.md +127 -127
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-oss-country-rates.md +100 -100
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-product-override.md +110 -110
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-shipping-tax-override.md +52 -52
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/save-tax-settings.md +166 -166
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/update-country-status.md +54 -54
- package/dist/skills/fluentcart-developer/references/restapi/operations/tax/update-tax-rate.md +116 -116
- package/dist/skills/fluentcart-developer/references/restapi/order-bumps.md +433 -433
- package/dist/skills/fluentcart-developer/references/restapi/orders.md +1212 -1212
- package/dist/skills/fluentcart-developer/references/restapi/pdf-templates.md +212 -212
- package/dist/skills/fluentcart-developer/references/restapi/products.md +2485 -2485
- package/dist/skills/fluentcart-developer/references/restapi/public-shop.md +191 -191
- package/dist/skills/fluentcart-developer/references/restapi/reports.md +3773 -3773
- package/dist/skills/fluentcart-developer/references/restapi/roles.md +403 -403
- package/dist/skills/fluentcart-developer/references/restapi/saved-views.md +136 -136
- package/dist/skills/fluentcart-developer/references/restapi/settings.md +1423 -1423
- package/dist/skills/fluentcart-developer/references/restapi/shipping.md +905 -905
- package/dist/skills/fluentcart-developer/references/restapi/subscriptions.md +1169 -1169
- package/dist/skills/fluentcart-developer/references/restapi/tax.md +1551 -1551
- package/dist/skills/fluentcart-developer/references/restapi.md +127 -127
- package/dist/skills/fluentcart-developer/scripts/cli.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +66 -65
|
@@ -1,645 +1,645 @@
|
|
|
1
|
-
# Cart Model
|
|
2
|
-
|
|
3
|
-
| DB Table Name | {wp_db_prefix}_fct_carts |
|
|
4
|
-
| --- | --- |
|
|
5
|
-
| Schema | [Check Schema](/database/schema.md#fct-carts-table) |
|
|
6
|
-
| Source File | fluent-cart/app/Models/Cart.php |
|
|
7
|
-
| Name Space | FluentCart\App\Models |
|
|
8
|
-
| Class | FluentCart\App\Models\Cart |
|
|
9
|
-
|
|
10
|
-
## Primary Key
|
|
11
|
-
|
|
12
|
-
The Cart model uses `cart_hash` (a string) as its primary key instead of the usual auto-incrementing `id`. The model sets `$incrementing = false` to reflect this. When creating a new Cart without providing a `cart_hash`, the `boot()` method auto-generates one using `md5('fct_global_cart_' . wp_generate_uuid4() . time())`.
|
|
13
|
-
|
|
14
|
-
## Traits
|
|
15
|
-
|
|
16
|
-
- **CanSearch** - Adds search scope capabilities to the model.
|
|
17
|
-
|
|
18
|
-
## Hidden Attributes
|
|
19
|
-
|
|
20
|
-
The following attributes are hidden from array/JSON serialization: `order_id`, `customer_id`, `user_id`.
|
|
21
|
-
|
|
22
|
-
## Attributes
|
|
23
|
-
|
|
24
|
-
| Attribute | Data Type | Comment |
|
|
25
|
-
| --- | --- | --- |
|
|
26
|
-
| cart_hash | String | Primary Key (non-incrementing) - Unique cart hash, auto-generated on creation |
|
|
27
|
-
| customer_id | Integer | Customer ID (nullable, hidden) |
|
|
28
|
-
| user_id | Integer | WordPress user ID (nullable, hidden) |
|
|
29
|
-
| order_id | Integer | Associated order ID (nullable, hidden) |
|
|
30
|
-
| checkout_data | JSON | Checkout data (auto JSON encoded/decoded via accessor/mutator) |
|
|
31
|
-
| cart_data | JSON | Cart items data (auto JSON encoded/decoded via accessor/mutator, loads bundle children on read) |
|
|
32
|
-
| utm_data | JSON | UTM tracking data (auto JSON encoded/decoded via accessor/mutator) |
|
|
33
|
-
| coupons | JSON | Applied coupon codes (auto JSON encoded/decoded via accessor/mutator) |
|
|
34
|
-
| first_name | String | Customer first name |
|
|
35
|
-
| last_name | String | Customer last name |
|
|
36
|
-
| email | String | Customer email |
|
|
37
|
-
| stage | String | Cart stage (e.g. `completed`) |
|
|
38
|
-
| cart_group | String | Cart group identifier |
|
|
39
|
-
| user_agent | Text | User agent string |
|
|
40
|
-
| ip_address | String | Customer IP address |
|
|
41
|
-
| completed_at | Date Time | Completion timestamp |
|
|
42
|
-
| deleted_at | Date Time | Soft delete timestamp |
|
|
43
|
-
| created_at | Date Time | Creation timestamp |
|
|
44
|
-
| updated_at | Date Time | Last update timestamp |
|
|
45
|
-
|
|
46
|
-
## Usage
|
|
47
|
-
|
|
48
|
-
Please check [Model Basic](/database/models.md) for Common methods.
|
|
49
|
-
|
|
50
|
-
### Accessing Attributes
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
54
|
-
|
|
55
|
-
$cart->cart_hash; // returns cart hash (primary key)
|
|
56
|
-
$cart->customer_id; // returns customer ID
|
|
57
|
-
$cart->cart_data; // returns decoded cart items array (with bundle children loaded)
|
|
58
|
-
$cart->checkout_data; // returns decoded checkout data array
|
|
59
|
-
$cart->coupons; // returns decoded coupon codes array
|
|
60
|
-
$cart->utm_data; // returns decoded UTM data array
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Boot behaviour
|
|
64
|
-
|
|
65
|
-
- `creating` — generates `cart_hash` when none is set
|
|
66
|
-
- `saving` — `CartCurrency::reconcile()` keeps one currency and one locked rate per cart
|
|
67
|
-
- `saved` — follow-up currency reconciliation
|
|
68
|
-
|
|
69
|
-
## Fees
|
|
70
|
-
|
|
71
|
-
A cart's fees are stored on the cart and surfaced as cart items:
|
|
72
|
-
|
|
73
|
-
| Method | Purpose |
|
|
74
|
-
| --- | --- |
|
|
75
|
-
| `getFees()` | the cart's fees, refreshing stale dynamic ones first |
|
|
76
|
-
| `getStoredFees()` | the fees as stored, without refreshing |
|
|
77
|
-
| `addFee(array $fee)` | add or replace a fee |
|
|
78
|
-
| `removeFee(string $key, ?string $source = null)` | remove one fee, optionally scoped to a source |
|
|
79
|
-
| `removeFeesBySource(string $source)` | remove every fee added by one source |
|
|
80
|
-
| `getFeeTotal()` | the summed fee amount |
|
|
81
|
-
| `getFeeCartItems()` | the fees as cart-item rows |
|
|
82
|
-
| `Cart::buildFeeCartItem(array $fee)` | build a single fee cart item (static) |
|
|
83
|
-
| `refreshStaleDynamicFees()` | recompute fees whose inputs have changed |
|
|
84
|
-
| `clearFeeCache()` | drop the in-request fee cache |
|
|
85
|
-
|
|
86
|
-
### acceptsAdditionalItems()
|
|
87
|
-
|
|
88
|
-
Whether more items may be added to this cart in its current stage.
|
|
89
|
-
|
|
90
|
-
- Returns `bool`
|
|
91
|
-
|
|
92
|
-
## Methods
|
|
93
|
-
|
|
94
|
-
Along with Global Model methods, this model has the following helper methods.
|
|
95
|
-
|
|
96
|
-
### Attribute Accessors / Mutators
|
|
97
|
-
|
|
98
|
-
#### setCheckoutDataAttribute($settings)
|
|
99
|
-
|
|
100
|
-
Set checkout data with JSON encoding.
|
|
101
|
-
|
|
102
|
-
- Parameters: `$settings` (Array) - Checkout settings
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
106
|
-
$cart->checkout_data = ['shipping_method' => 'standard'];
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
#### getCheckoutDataAttribute($settings)
|
|
110
|
-
|
|
111
|
-
Get checkout data with JSON decoding. Returns an empty array if value is falsy or not valid JSON.
|
|
112
|
-
|
|
113
|
-
- Parameters: `$settings` (String) - Raw JSON settings from database
|
|
114
|
-
- Returns `Array` - Decoded checkout data
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
118
|
-
$checkoutData = $cart->checkout_data; // returns array
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
#### setCouponsAttribute($coupons)
|
|
122
|
-
|
|
123
|
-
Set coupons with JSON encoding. Non-array values are reset to an empty array.
|
|
124
|
-
|
|
125
|
-
- Parameters: `$coupons` (Array) - Coupon codes
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
129
|
-
$cart->coupons = ['SAVE10', 'WELCOME20'];
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
#### getCouponsAttribute($coupons)
|
|
133
|
-
|
|
134
|
-
Get coupons with JSON decoding. Returns an empty array if value is falsy or not valid JSON.
|
|
135
|
-
|
|
136
|
-
- Parameters: `$coupons` (String) - Raw JSON coupons from database
|
|
137
|
-
- Returns `Array` - Decoded coupon codes
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
141
|
-
$coupons = $cart->coupons; // returns array
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
#### setCartDataAttribute($settings)
|
|
145
|
-
|
|
146
|
-
Set cart data with JSON encoding. Also invalidates the internal static cache for this cart.
|
|
147
|
-
|
|
148
|
-
- Parameters: `$settings` (Array) - Cart item data
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
152
|
-
$cart->cart_data = [['product_id' => 1, 'quantity' => 2]];
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
#### getCartDataAttribute($data)
|
|
156
|
-
|
|
157
|
-
Get cart data with JSON decoding. Uses an internal static cache keyed by `cart_hash` for performance. Automatically loads bundle child items via `Helper::loadBundleChild()`.
|
|
158
|
-
|
|
159
|
-
- Parameters: `$data` (String) - Raw JSON data from database
|
|
160
|
-
- Returns `Array` - Decoded cart data with bundle children resolved
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
164
|
-
$cartData = $cart->cart_data; // returns array with bundle children loaded
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### setUtmDataAttribute($utmData)
|
|
168
|
-
|
|
169
|
-
Set UTM data with JSON encoding.
|
|
170
|
-
|
|
171
|
-
- Parameters: `$utmData` (Array) - UTM data
|
|
172
|
-
|
|
173
|
-
```
|
|
174
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
175
|
-
$cart->utm_data = ['utm_source' => 'google', 'utm_campaign' => 'summer'];
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
#### getUtmDataAttribute($utmData)
|
|
179
|
-
|
|
180
|
-
Get UTM data with JSON decoding. Returns an empty array if value is falsy.
|
|
181
|
-
|
|
182
|
-
- Parameters: `$utmData` (String) - Raw JSON UTM data from database
|
|
183
|
-
- Returns `Array` - Decoded UTM data
|
|
184
|
-
|
|
185
|
-
```
|
|
186
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
187
|
-
$utmData = $cart->utm_data; // returns array
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Cart State Methods
|
|
191
|
-
|
|
192
|
-
#### isLocked()
|
|
193
|
-
|
|
194
|
-
Check if cart is locked. A cart is locked when `checkout_data.is_locked` is `'yes'` AND the cart has an associated `order_id`.
|
|
195
|
-
|
|
196
|
-
- Returns `Boolean` - True if cart is locked
|
|
197
|
-
|
|
198
|
-
```
|
|
199
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
200
|
-
$isLocked = $cart->isLocked();
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
#### isZeroPayment()
|
|
204
|
-
|
|
205
|
-
Check if the cart has a zero payment amount and does not contain subscription items. Useful for determining if payment processing can be skipped.
|
|
206
|
-
|
|
207
|
-
- Returns `Boolean` - True if estimated total is zero and no subscription items exist
|
|
208
|
-
|
|
209
|
-
```
|
|
210
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
211
|
-
if ($cart->isZeroPayment()) {
|
|
212
|
-
// No payment processing needed
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
#### isShipToDifferent()
|
|
217
|
-
|
|
218
|
-
Check if the customer has opted to ship to a different address than the billing address.
|
|
219
|
-
|
|
220
|
-
- Returns `Boolean` - True if `checkout_data.form_data.ship_to_different` is `'yes'`
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
224
|
-
if ($cart->isShipToDifferent()) {
|
|
225
|
-
// Use separate shipping address
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
#### hasSubscription()
|
|
230
|
-
|
|
231
|
-
Check if cart contains any subscription items by inspecting `other_info.payment_type` in each cart data item.
|
|
232
|
-
|
|
233
|
-
- Returns `Boolean` - True if any item has a `subscription` payment type
|
|
234
|
-
|
|
235
|
-
```
|
|
236
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
237
|
-
$hasSubscription = $cart->hasSubscription();
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
#### requireShipping()
|
|
241
|
-
|
|
242
|
-
Check if cart requires shipping by inspecting `fulfillment_type` in each cart data item.
|
|
243
|
-
|
|
244
|
-
- Returns `Boolean` - True if any item has a `physical` fulfillment type
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
248
|
-
$requiresShipping = $cart->requireShipping();
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Cart Item Methods
|
|
252
|
-
|
|
253
|
-
#### addItem($item = [], $replacingIndex = null)
|
|
254
|
-
|
|
255
|
-
Add an item to the cart. If the cart is locked, returns a `WP_Error`. If `$replacingIndex` is provided and exists, replaces that item; otherwise appends the item. Saves the cart, re-validates coupons, and fires `fluent_cart/cart/item_added` and `fluent_cart/cart/cart_data_items_updated` actions.
|
|
256
|
-
|
|
257
|
-
- Parameters: `$item` (Array) - Cart item data
|
|
258
|
-
- `$replacingIndex` (Integer|null) - Index of existing item to replace
|
|
259
|
-
|
|
260
|
-
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
264
|
-
$cart->addItem(['product_id' => 1, 'quantity' => 2]);
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
#### removeItem($variationId, $extraArgs = [], $triggerEvent = true)
|
|
268
|
-
|
|
269
|
-
Remove an item from the cart by variation ID. Uses `findExistingItemAndIndex()` to locate the item. If the cart is locked, returns a `WP_Error`. When `$triggerEvent` is true, re-validates coupons and fires `fluent_cart/cart/item_removed`; otherwise fires `fluent_cart/checkout/cart_amount_updated`. Always fires `fluent_cart/cart/cart_data_items_updated`.
|
|
270
|
-
|
|
271
|
-
- Parameters: `$variationId` (Integer) - Variation/object ID to remove
|
|
272
|
-
- `$extraArgs` (Array) - Additional matching arguments for identifying the item
|
|
273
|
-
- `$triggerEvent` (Boolean) - Whether to trigger item_removed event (default: true)
|
|
274
|
-
|
|
275
|
-
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
279
|
-
$cart->removeItem(1, [], true);
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
#### addByVariation(ProductVariation $variation, $config = [])
|
|
283
|
-
|
|
284
|
-
Add a product variation to the cart with full business logic. Handles quantity adjustments, existing item replacement, promotional price locking, stock validation, and purchase eligibility checks via `canPurchase()`. Uses `CartHelper::generateCartItemFromVariation()` to build the cart item. If quantity is 0, removes the item instead.
|
|
285
|
-
|
|
286
|
-
- Parameters: `$variation` (ProductVariation) - Product variation model instance
|
|
287
|
-
- `$config` (Array) - Configuration options: `quantity` (int) - Desired quantity (default: 1; 0 removes the item)
|
|
288
|
-
- `by_input` (bool) - If true, sets quantity directly instead of incrementing
|
|
289
|
-
- `will_validate` (bool) - If true, runs stock/purchase validation
|
|
290
|
-
- `replace` (bool) - If true, removes existing item before adding
|
|
291
|
-
- `remove_args` (array) - Extra args for matching when removing
|
|
292
|
-
- `matched_args` (array) - Extra args for matching existing items
|
|
293
|
-
- `other_info` (array) - Additional info merged into item's `other_info`
|
|
294
|
-
|
|
295
|
-
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error
|
|
296
|
-
|
|
297
|
-
```
|
|
298
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
299
|
-
$variation = FluentCart\App\Models\ProductVariation::find(1);
|
|
300
|
-
$cart->addByVariation($variation, ['quantity' => 2, 'will_validate' => true]);
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
#### addByCustom(array $variation, array $config = [])
|
|
304
|
-
|
|
305
|
-
Add a custom (non-standard) item to the cart. Normalizes the item via `CartHelper::normalizeCustomFields()`, validates required fields (`id`, `object_id`, `post_id`, `post_title`, `price`, `unit_price`, `payment_type`), and rejects subscription items (which must use direct checkout). Uses `CartHelper::generateCartItemCustomItem()` to build the cart item.
|
|
306
|
-
|
|
307
|
-
- Parameters: `$variation` (Array) - Custom item data with required fields
|
|
308
|
-
- `$config` (Array) - Configuration options: `quantity` (int) - Desired quantity (default: 1; 0 removes the item)
|
|
309
|
-
- `remove_args` (array) - Extra args for matching when removing
|
|
310
|
-
- `matched_args` (array) - Extra args for matching existing items
|
|
311
|
-
|
|
312
|
-
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error
|
|
313
|
-
|
|
314
|
-
```
|
|
315
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
316
|
-
$cart->addByCustom([
|
|
317
|
-
'id' => 100,
|
|
318
|
-
'object_id' => 100,
|
|
319
|
-
'post_id' => 50,
|
|
320
|
-
'post_title' => 'Custom Item',
|
|
321
|
-
'price' => 1500,
|
|
322
|
-
'unit_price' => 1500,
|
|
323
|
-
'payment_type' => 'one_time',
|
|
324
|
-
], ['quantity' => 1]);
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
#### findExistingItemAndIndex($objectId, $extraArgs = [])
|
|
328
|
-
|
|
329
|
-
Find an existing cart item and its index by `object_id`. Optionally matches additional arguments against the item using dot-notation keys.
|
|
330
|
-
|
|
331
|
-
- Parameters: `$objectId` (Integer) - The object ID to search for
|
|
332
|
-
- `$extraArgs` (Array) - Additional key-value pairs to match against the item
|
|
333
|
-
|
|
334
|
-
Returns `Array|null` - `[$index, $item]` tuple if found, or null
|
|
335
|
-
|
|
336
|
-
```
|
|
337
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
338
|
-
$result = $cart->findExistingItemAndIndex(100, ['other_info.color' => 'red']);
|
|
339
|
-
if ($result) {
|
|
340
|
-
[$index, $item] = $result;
|
|
341
|
-
}
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
### Coupon Methods
|
|
345
|
-
|
|
346
|
-
#### applyCoupon($codes = [])
|
|
347
|
-
|
|
348
|
-
Apply coupon codes to the cart. If the cart is locked, returns a `WP_Error`. Creates a `DiscountService` instance to calculate discounts, updates `cart_data`, `coupons`, and `checkout_data.__per_coupon_discounts`, then saves. Fires `fluent_cart/checkout/cart_amount_updated` and `fluent_cart/cart/cart_data_items_updated` actions.
|
|
349
|
-
|
|
350
|
-
- Parameters: `$codes` (Array) - Coupon codes to apply
|
|
351
|
-
- Returns `Mixed` - Discount service result or `WP_Error` if locked/invalid
|
|
352
|
-
|
|
353
|
-
```
|
|
354
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
355
|
-
$result = $cart->applyCoupon(['SAVE10', 'WELCOME20']);
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
#### removeCoupon($removeCodes = [])
|
|
359
|
-
|
|
360
|
-
Remove specific coupon codes from the cart. Accepts a single code string or an array. Re-validates remaining coupons via `DiscountService` and updates `cart_data`, `coupons`, and `checkout_data.__per_coupon_discounts`. If the cart is locked, returns a `WP_Error`.
|
|
361
|
-
|
|
362
|
-
- Parameters: `$removeCodes` (Array|String) - Coupon code(s) to remove
|
|
363
|
-
- Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
364
|
-
|
|
365
|
-
```
|
|
366
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
367
|
-
$cart->removeCoupon(['SAVE10']);
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
#### reValidateCoupons()
|
|
371
|
-
|
|
372
|
-
Re-validate all currently applied coupons against the current cart state. Recalculates discounts via `DiscountService`, updates `cart_data`, `coupons`, and `checkout_data.__per_coupon_discounts`. Fires `fluent_cart/checkout/cart_amount_updated` and conditionally fires `fluent_cart/cart/cart_data_items_updated` if discount totals changed.
|
|
373
|
-
|
|
374
|
-
- Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
375
|
-
|
|
376
|
-
```
|
|
377
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
378
|
-
$cart->reValidateCoupons();
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
#### getDiscountLines($revalidate = false)
|
|
382
|
-
|
|
383
|
-
Get formatted discount line items for all applied coupons. Each line includes coupon ID, code, type, discount amount, formatted price HTML, and formatted title. When only one coupon is applied, sums `coupon_discount` from each cart item. When multiple coupons are applied, reads per-coupon breakdowns from `checkout_data.__per_coupon_discounts`.
|
|
384
|
-
|
|
385
|
-
- Parameters: `$revalidate` (Boolean) - If true, re-applies coupons before calculating (default: false)
|
|
386
|
-
- Returns `Array` - Associative array keyed by coupon code, each containing `id`, `code`, `type`, `discount`, `formatted_discount`, `actual_formatted_discount`, `formatted_title`
|
|
387
|
-
|
|
388
|
-
```
|
|
389
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
390
|
-
$discountLines = $cart->getDiscountLines();
|
|
391
|
-
// Example output:
|
|
392
|
-
// ['SAVE10' => ['id' => 1, 'code' => 'SAVE10', 'discount' => 500, ...]]
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Totals & Calculation Methods
|
|
396
|
-
|
|
397
|
-
#### getShippingTotal()
|
|
398
|
-
|
|
399
|
-
Get the shipping total for the cart. Returns 0 if the cart does not require shipping.
|
|
400
|
-
|
|
401
|
-
- Returns `Integer` - Shipping total in cents
|
|
402
|
-
|
|
403
|
-
```
|
|
404
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
405
|
-
$shippingTotal = $cart->getShippingTotal();
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
#### getItemsSubtotal()
|
|
409
|
-
|
|
410
|
-
Get the items subtotal (before discounts) by combining one-time and subscription items via `CheckoutService` and `OrderService::getItemsAmountWithoutDiscount()`.
|
|
411
|
-
|
|
412
|
-
- Returns `Integer` - Items subtotal in cents
|
|
413
|
-
|
|
414
|
-
```
|
|
415
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
416
|
-
$subtotal = $cart->getItemsSubtotal();
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
#### getEstimatedTotal($extraAmount = 0)
|
|
420
|
-
|
|
421
|
-
Get the estimated cart total including item totals, fees, shipping, and custom checkout adjustments. The sequence is:
|
|
422
|
-
|
|
423
|
-
1. A **recursion guard** — if a hook calls `getEstimatedTotal()` again, the call falls through to the private raw calculation so hooks run only once.
|
|
424
|
-
2. `do_action('fluent_cart/cart/before_totals_calculation')`.
|
|
425
|
-
3. `apply_filters('fluent_cart/cart/item_dynamic_discount', $cart_data, ...)`, so a filter can rewrite line items before they are priced.
|
|
426
|
-
4. One-time and subscription items are combined via `CheckoutService`, then totalled by `OrderService::getItemsAmountTotal()`.
|
|
427
|
-
5. Fees, shipping, prorate credit and upgrade discounts are applied.
|
|
428
|
-
6. `apply_filters('fluent_cart/cart/estimated_total', ...)`, and the result is floored at 0.
|
|
429
|
-
|
|
430
|
-
- Parameters: `$extraAmount` (Integer) - Extra amount in cents to include (default: 0)
|
|
431
|
-
- Returns `Integer` - Estimated total in cents (minimum 0)
|
|
432
|
-
|
|
433
|
-
```
|
|
434
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
435
|
-
$total = $cart->getEstimatedTotal(1000); // $10.00 extra
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
#### getEstimatedRecurringTotal()
|
|
439
|
-
|
|
440
|
-
Get the estimated recurring total for subscription items only. Sums each subscription item's `subtotal` minus its `recurring_discounts.amount`.
|
|
441
|
-
|
|
442
|
-
- Returns `Integer` - Estimated recurring total in cents
|
|
443
|
-
|
|
444
|
-
```
|
|
445
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
446
|
-
$recurringTotal = $cart->getEstimatedRecurringTotal();
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
### Address Methods
|
|
450
|
-
|
|
451
|
-
#### getBillingAddress()
|
|
452
|
-
|
|
453
|
-
Get the billing address from checkout form data.
|
|
454
|
-
|
|
455
|
-
- Returns `Array` - Associative array with keys: `full_name`, `company`, `address_1`, `address_2`, `city`, `state`, `postcode`, `country`
|
|
456
|
-
|
|
457
|
-
```
|
|
458
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
459
|
-
$billing = $cart->getBillingAddress();
|
|
460
|
-
// ['full_name' => 'John Doe', 'company' => '', 'address_1' => '123 Main St', ...]
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
#### getShippingAddress()
|
|
464
|
-
|
|
465
|
-
Get the shipping address. If the customer opted to ship to a different address (`isShipToDifferent()`), returns the separate shipping address fields from form data. Otherwise, falls back to `getBillingAddress()`.
|
|
466
|
-
|
|
467
|
-
- Returns `Array` - Associative array with keys: `full_name`, `company`, `address_1`, `address_2`, `city`, `state`, `postcode`, `country`
|
|
468
|
-
|
|
469
|
-
```
|
|
470
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
471
|
-
$shipping = $cart->getShippingAddress();
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### Customer Methods
|
|
475
|
-
|
|
476
|
-
#### guessCustomer()
|
|
477
|
-
|
|
478
|
-
Attempt to find the associated customer by checking (in order): `customer_id`, `user_id`, then `email`. Returns the first matching `Customer` model found, or null if none match.
|
|
479
|
-
|
|
480
|
-
- Returns `FluentCart\App\Models\Customer|null` - Customer instance or null
|
|
481
|
-
|
|
482
|
-
```
|
|
483
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
484
|
-
$customer = $cart->guessCustomer();
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
### Action Hook Helper Methods
|
|
488
|
-
|
|
489
|
-
#### addDraftCreatedActions($hooks)
|
|
490
|
-
|
|
491
|
-
Build a response array for actions to execute after a draft order is created. Deduplicates the hooks array.
|
|
492
|
-
|
|
493
|
-
- Parameters: `$hooks` (Array) - Hook identifiers
|
|
494
|
-
- Returns `Array` - `['__after_draft_created_actions__' => [...]]`
|
|
495
|
-
|
|
496
|
-
#### addSuccessActions($hooks)
|
|
497
|
-
|
|
498
|
-
Build a response array for actions to execute on successful checkout. Deduplicates the hooks array.
|
|
499
|
-
|
|
500
|
-
- Parameters: `$hooks` (Array) - Hook identifiers
|
|
501
|
-
- Returns `Array` - `['__on_success_actions__' => [...]]`
|
|
502
|
-
|
|
503
|
-
#### addCartNotices($notices)
|
|
504
|
-
|
|
505
|
-
Build a response array for cart notices to display. Deduplicates by notice `id`.
|
|
506
|
-
|
|
507
|
-
- Parameters: `$notices` (Array) - Array of notice arrays, each with an `id` key
|
|
508
|
-
- Returns `Array` - `['__cart_notices' => [...]]`
|
|
509
|
-
|
|
510
|
-
```
|
|
511
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
512
|
-
$actions = $cart->addSuccessActions(['redirect_to_thank_you', 'clear_cart']);
|
|
513
|
-
$notices = $cart->addCartNotices([
|
|
514
|
-
['id' => 'stock_warning', 'message' => 'Limited stock remaining']
|
|
515
|
-
]);
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
## Relations
|
|
519
|
-
|
|
520
|
-
This model has the following relationships that you can use.
|
|
521
|
-
|
|
522
|
-
### customer
|
|
523
|
-
|
|
524
|
-
Access the associated customer (BelongsTo).
|
|
525
|
-
|
|
526
|
-
- Returns `FluentCart\App\Models\Customer`
|
|
527
|
-
- Foreign Key: `customer_id`
|
|
528
|
-
|
|
529
|
-
```
|
|
530
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
531
|
-
$customer = $cart->customer;
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
### order
|
|
535
|
-
|
|
536
|
-
Access the associated order (BelongsTo).
|
|
537
|
-
|
|
538
|
-
- Returns `FluentCart\App\Models\Order`
|
|
539
|
-
- Foreign Key: `order_id`
|
|
540
|
-
|
|
541
|
-
```
|
|
542
|
-
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
543
|
-
$order = $cart->order;
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
## Scopes
|
|
547
|
-
|
|
548
|
-
This model has the following scopes that you can use.
|
|
549
|
-
|
|
550
|
-
### stageNotCompleted()
|
|
551
|
-
|
|
552
|
-
Get carts where the `stage` column is not `completed`.
|
|
553
|
-
|
|
554
|
-
```
|
|
555
|
-
$carts = FluentCart\App\Models\Cart::stageNotCompleted()->get();
|
|
556
|
-
```
|
|
557
|
-
|
|
558
|
-
## Usage Examples
|
|
559
|
-
|
|
560
|
-
### Creating a Cart
|
|
561
|
-
|
|
562
|
-
The `cart_hash` is auto-generated if not provided:
|
|
563
|
-
|
|
564
|
-
```
|
|
565
|
-
use FluentCart\App\Models\Cart;
|
|
566
|
-
|
|
567
|
-
// Auto-generated cart_hash
|
|
568
|
-
$cart = Cart::create([
|
|
569
|
-
'customer_id' => 1,
|
|
570
|
-
'email' => '[email protected]',
|
|
571
|
-
]);
|
|
572
|
-
|
|
573
|
-
// Or with explicit cart_hash
|
|
574
|
-
$cart = Cart::create([
|
|
575
|
-
'cart_hash' => 'unique_cart_hash_123',
|
|
576
|
-
'customer_id' => 1,
|
|
577
|
-
'email' => '[email protected]',
|
|
578
|
-
]);
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
### Retrieving Carts
|
|
582
|
-
|
|
583
|
-
```
|
|
584
|
-
// Get cart by hash (primary key)
|
|
585
|
-
$cart = Cart::find('cart_hash_123');
|
|
586
|
-
|
|
587
|
-
// Get carts that are not completed
|
|
588
|
-
$carts = Cart::stageNotCompleted()->get();
|
|
589
|
-
|
|
590
|
-
// Get cart with customer eager-loaded
|
|
591
|
-
$cart = Cart::with('customer')->find('cart_hash_123');
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
### Working with Cart Items
|
|
595
|
-
|
|
596
|
-
```
|
|
597
|
-
$cart = Cart::find('cart_hash_123');
|
|
598
|
-
|
|
599
|
-
// Add by variation with validation
|
|
600
|
-
$variation = \FluentCart\App\Models\ProductVariation::find(1);
|
|
601
|
-
$cart->addByVariation($variation, [
|
|
602
|
-
'quantity' => 2,
|
|
603
|
-
'will_validate' => true,
|
|
604
|
-
]);
|
|
605
|
-
|
|
606
|
-
// Remove an item
|
|
607
|
-
$cart->removeItem($variation->id);
|
|
608
|
-
|
|
609
|
-
// Check totals
|
|
610
|
-
$subtotal = $cart->getItemsSubtotal();
|
|
611
|
-
$total = $cart->getEstimatedTotal();
|
|
612
|
-
$recurringTotal = $cart->getEstimatedRecurringTotal();
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### Working with Coupons
|
|
616
|
-
|
|
617
|
-
```
|
|
618
|
-
$cart = Cart::find('cart_hash_123');
|
|
619
|
-
|
|
620
|
-
// Apply coupons
|
|
621
|
-
$result = $cart->applyCoupon(['SAVE10']);
|
|
622
|
-
|
|
623
|
-
// Get discount lines for display
|
|
624
|
-
$discountLines = $cart->getDiscountLines();
|
|
625
|
-
|
|
626
|
-
// Remove a coupon
|
|
627
|
-
$cart->removeCoupon(['SAVE10']);
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
### Updating a Cart
|
|
631
|
-
|
|
632
|
-
```
|
|
633
|
-
$cart = Cart::find('cart_hash_123');
|
|
634
|
-
$cart->email = '[email protected]';
|
|
635
|
-
$cart->save();
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
### Deleting a Cart
|
|
639
|
-
|
|
640
|
-
```
|
|
641
|
-
$cart = Cart::find('cart_hash_123');
|
|
642
|
-
$cart->delete(); // Soft delete
|
|
643
|
-
```
|
|
644
|
-
|
|
645
|
-
---
|
|
1
|
+
# Cart Model
|
|
2
|
+
|
|
3
|
+
| DB Table Name | {wp_db_prefix}_fct_carts |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| Schema | [Check Schema](/database/schema.md#fct-carts-table) |
|
|
6
|
+
| Source File | fluent-cart/app/Models/Cart.php |
|
|
7
|
+
| Name Space | FluentCart\App\Models |
|
|
8
|
+
| Class | FluentCart\App\Models\Cart |
|
|
9
|
+
|
|
10
|
+
## Primary Key
|
|
11
|
+
|
|
12
|
+
The Cart model uses `cart_hash` (a string) as its primary key instead of the usual auto-incrementing `id`. The model sets `$incrementing = false` to reflect this. When creating a new Cart without providing a `cart_hash`, the `boot()` method auto-generates one using `md5('fct_global_cart_' . wp_generate_uuid4() . time())`.
|
|
13
|
+
|
|
14
|
+
## Traits
|
|
15
|
+
|
|
16
|
+
- **CanSearch** - Adds search scope capabilities to the model.
|
|
17
|
+
|
|
18
|
+
## Hidden Attributes
|
|
19
|
+
|
|
20
|
+
The following attributes are hidden from array/JSON serialization: `order_id`, `customer_id`, `user_id`.
|
|
21
|
+
|
|
22
|
+
## Attributes
|
|
23
|
+
|
|
24
|
+
| Attribute | Data Type | Comment |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| cart_hash | String | Primary Key (non-incrementing) - Unique cart hash, auto-generated on creation |
|
|
27
|
+
| customer_id | Integer | Customer ID (nullable, hidden) |
|
|
28
|
+
| user_id | Integer | WordPress user ID (nullable, hidden) |
|
|
29
|
+
| order_id | Integer | Associated order ID (nullable, hidden) |
|
|
30
|
+
| checkout_data | JSON | Checkout data (auto JSON encoded/decoded via accessor/mutator) |
|
|
31
|
+
| cart_data | JSON | Cart items data (auto JSON encoded/decoded via accessor/mutator, loads bundle children on read) |
|
|
32
|
+
| utm_data | JSON | UTM tracking data (auto JSON encoded/decoded via accessor/mutator) |
|
|
33
|
+
| coupons | JSON | Applied coupon codes (auto JSON encoded/decoded via accessor/mutator) |
|
|
34
|
+
| first_name | String | Customer first name |
|
|
35
|
+
| last_name | String | Customer last name |
|
|
36
|
+
| email | String | Customer email |
|
|
37
|
+
| stage | String | Cart stage (e.g. `completed`) |
|
|
38
|
+
| cart_group | String | Cart group identifier |
|
|
39
|
+
| user_agent | Text | User agent string |
|
|
40
|
+
| ip_address | String | Customer IP address |
|
|
41
|
+
| completed_at | Date Time | Completion timestamp |
|
|
42
|
+
| deleted_at | Date Time | Soft delete timestamp |
|
|
43
|
+
| created_at | Date Time | Creation timestamp |
|
|
44
|
+
| updated_at | Date Time | Last update timestamp |
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
Please check [Model Basic](/database/models.md) for Common methods.
|
|
49
|
+
|
|
50
|
+
### Accessing Attributes
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
54
|
+
|
|
55
|
+
$cart->cart_hash; // returns cart hash (primary key)
|
|
56
|
+
$cart->customer_id; // returns customer ID
|
|
57
|
+
$cart->cart_data; // returns decoded cart items array (with bundle children loaded)
|
|
58
|
+
$cart->checkout_data; // returns decoded checkout data array
|
|
59
|
+
$cart->coupons; // returns decoded coupon codes array
|
|
60
|
+
$cart->utm_data; // returns decoded UTM data array
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Boot behaviour
|
|
64
|
+
|
|
65
|
+
- `creating` — generates `cart_hash` when none is set
|
|
66
|
+
- `saving` — `CartCurrency::reconcile()` keeps one currency and one locked rate per cart
|
|
67
|
+
- `saved` — follow-up currency reconciliation
|
|
68
|
+
|
|
69
|
+
## Fees
|
|
70
|
+
|
|
71
|
+
A cart's fees are stored on the cart and surfaced as cart items:
|
|
72
|
+
|
|
73
|
+
| Method | Purpose |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `getFees()` | the cart's fees, refreshing stale dynamic ones first |
|
|
76
|
+
| `getStoredFees()` | the fees as stored, without refreshing |
|
|
77
|
+
| `addFee(array $fee)` | add or replace a fee |
|
|
78
|
+
| `removeFee(string $key, ?string $source = null)` | remove one fee, optionally scoped to a source |
|
|
79
|
+
| `removeFeesBySource(string $source)` | remove every fee added by one source |
|
|
80
|
+
| `getFeeTotal()` | the summed fee amount |
|
|
81
|
+
| `getFeeCartItems()` | the fees as cart-item rows |
|
|
82
|
+
| `Cart::buildFeeCartItem(array $fee)` | build a single fee cart item (static) |
|
|
83
|
+
| `refreshStaleDynamicFees()` | recompute fees whose inputs have changed |
|
|
84
|
+
| `clearFeeCache()` | drop the in-request fee cache |
|
|
85
|
+
|
|
86
|
+
### acceptsAdditionalItems()
|
|
87
|
+
|
|
88
|
+
Whether more items may be added to this cart in its current stage.
|
|
89
|
+
|
|
90
|
+
- Returns `bool`
|
|
91
|
+
|
|
92
|
+
## Methods
|
|
93
|
+
|
|
94
|
+
Along with Global Model methods, this model has the following helper methods.
|
|
95
|
+
|
|
96
|
+
### Attribute Accessors / Mutators
|
|
97
|
+
|
|
98
|
+
#### setCheckoutDataAttribute($settings)
|
|
99
|
+
|
|
100
|
+
Set checkout data with JSON encoding.
|
|
101
|
+
|
|
102
|
+
- Parameters: `$settings` (Array) - Checkout settings
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
106
|
+
$cart->checkout_data = ['shipping_method' => 'standard'];
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### getCheckoutDataAttribute($settings)
|
|
110
|
+
|
|
111
|
+
Get checkout data with JSON decoding. Returns an empty array if value is falsy or not valid JSON.
|
|
112
|
+
|
|
113
|
+
- Parameters: `$settings` (String) - Raw JSON settings from database
|
|
114
|
+
- Returns `Array` - Decoded checkout data
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
118
|
+
$checkoutData = $cart->checkout_data; // returns array
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### setCouponsAttribute($coupons)
|
|
122
|
+
|
|
123
|
+
Set coupons with JSON encoding. Non-array values are reset to an empty array.
|
|
124
|
+
|
|
125
|
+
- Parameters: `$coupons` (Array) - Coupon codes
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
129
|
+
$cart->coupons = ['SAVE10', 'WELCOME20'];
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### getCouponsAttribute($coupons)
|
|
133
|
+
|
|
134
|
+
Get coupons with JSON decoding. Returns an empty array if value is falsy or not valid JSON.
|
|
135
|
+
|
|
136
|
+
- Parameters: `$coupons` (String) - Raw JSON coupons from database
|
|
137
|
+
- Returns `Array` - Decoded coupon codes
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
141
|
+
$coupons = $cart->coupons; // returns array
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### setCartDataAttribute($settings)
|
|
145
|
+
|
|
146
|
+
Set cart data with JSON encoding. Also invalidates the internal static cache for this cart.
|
|
147
|
+
|
|
148
|
+
- Parameters: `$settings` (Array) - Cart item data
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
152
|
+
$cart->cart_data = [['product_id' => 1, 'quantity' => 2]];
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### getCartDataAttribute($data)
|
|
156
|
+
|
|
157
|
+
Get cart data with JSON decoding. Uses an internal static cache keyed by `cart_hash` for performance. Automatically loads bundle child items via `Helper::loadBundleChild()`.
|
|
158
|
+
|
|
159
|
+
- Parameters: `$data` (String) - Raw JSON data from database
|
|
160
|
+
- Returns `Array` - Decoded cart data with bundle children resolved
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
164
|
+
$cartData = $cart->cart_data; // returns array with bundle children loaded
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### setUtmDataAttribute($utmData)
|
|
168
|
+
|
|
169
|
+
Set UTM data with JSON encoding.
|
|
170
|
+
|
|
171
|
+
- Parameters: `$utmData` (Array) - UTM data
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
175
|
+
$cart->utm_data = ['utm_source' => 'google', 'utm_campaign' => 'summer'];
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### getUtmDataAttribute($utmData)
|
|
179
|
+
|
|
180
|
+
Get UTM data with JSON decoding. Returns an empty array if value is falsy.
|
|
181
|
+
|
|
182
|
+
- Parameters: `$utmData` (String) - Raw JSON UTM data from database
|
|
183
|
+
- Returns `Array` - Decoded UTM data
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
187
|
+
$utmData = $cart->utm_data; // returns array
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Cart State Methods
|
|
191
|
+
|
|
192
|
+
#### isLocked()
|
|
193
|
+
|
|
194
|
+
Check if cart is locked. A cart is locked when `checkout_data.is_locked` is `'yes'` AND the cart has an associated `order_id`.
|
|
195
|
+
|
|
196
|
+
- Returns `Boolean` - True if cart is locked
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
200
|
+
$isLocked = $cart->isLocked();
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### isZeroPayment()
|
|
204
|
+
|
|
205
|
+
Check if the cart has a zero payment amount and does not contain subscription items. Useful for determining if payment processing can be skipped.
|
|
206
|
+
|
|
207
|
+
- Returns `Boolean` - True if estimated total is zero and no subscription items exist
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
211
|
+
if ($cart->isZeroPayment()) {
|
|
212
|
+
// No payment processing needed
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### isShipToDifferent()
|
|
217
|
+
|
|
218
|
+
Check if the customer has opted to ship to a different address than the billing address.
|
|
219
|
+
|
|
220
|
+
- Returns `Boolean` - True if `checkout_data.form_data.ship_to_different` is `'yes'`
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
224
|
+
if ($cart->isShipToDifferent()) {
|
|
225
|
+
// Use separate shipping address
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### hasSubscription()
|
|
230
|
+
|
|
231
|
+
Check if cart contains any subscription items by inspecting `other_info.payment_type` in each cart data item.
|
|
232
|
+
|
|
233
|
+
- Returns `Boolean` - True if any item has a `subscription` payment type
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
237
|
+
$hasSubscription = $cart->hasSubscription();
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### requireShipping()
|
|
241
|
+
|
|
242
|
+
Check if cart requires shipping by inspecting `fulfillment_type` in each cart data item.
|
|
243
|
+
|
|
244
|
+
- Returns `Boolean` - True if any item has a `physical` fulfillment type
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
248
|
+
$requiresShipping = $cart->requireShipping();
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Cart Item Methods
|
|
252
|
+
|
|
253
|
+
#### addItem($item = [], $replacingIndex = null)
|
|
254
|
+
|
|
255
|
+
Add an item to the cart. If the cart is locked, returns a `WP_Error`. If `$replacingIndex` is provided and exists, replaces that item; otherwise appends the item. Saves the cart, re-validates coupons, and fires `fluent_cart/cart/item_added` and `fluent_cart/cart/cart_data_items_updated` actions.
|
|
256
|
+
|
|
257
|
+
- Parameters: `$item` (Array) - Cart item data
|
|
258
|
+
- `$replacingIndex` (Integer|null) - Index of existing item to replace
|
|
259
|
+
|
|
260
|
+
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
264
|
+
$cart->addItem(['product_id' => 1, 'quantity' => 2]);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### removeItem($variationId, $extraArgs = [], $triggerEvent = true)
|
|
268
|
+
|
|
269
|
+
Remove an item from the cart by variation ID. Uses `findExistingItemAndIndex()` to locate the item. If the cart is locked, returns a `WP_Error`. When `$triggerEvent` is true, re-validates coupons and fires `fluent_cart/cart/item_removed`; otherwise fires `fluent_cart/checkout/cart_amount_updated`. Always fires `fluent_cart/cart/cart_data_items_updated`.
|
|
270
|
+
|
|
271
|
+
- Parameters: `$variationId` (Integer) - Variation/object ID to remove
|
|
272
|
+
- `$extraArgs` (Array) - Additional matching arguments for identifying the item
|
|
273
|
+
- `$triggerEvent` (Boolean) - Whether to trigger item_removed event (default: true)
|
|
274
|
+
|
|
275
|
+
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
279
|
+
$cart->removeItem(1, [], true);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
#### addByVariation(ProductVariation $variation, $config = [])
|
|
283
|
+
|
|
284
|
+
Add a product variation to the cart with full business logic. Handles quantity adjustments, existing item replacement, promotional price locking, stock validation, and purchase eligibility checks via `canPurchase()`. Uses `CartHelper::generateCartItemFromVariation()` to build the cart item. If quantity is 0, removes the item instead.
|
|
285
|
+
|
|
286
|
+
- Parameters: `$variation` (ProductVariation) - Product variation model instance
|
|
287
|
+
- `$config` (Array) - Configuration options: `quantity` (int) - Desired quantity (default: 1; 0 removes the item)
|
|
288
|
+
- `by_input` (bool) - If true, sets quantity directly instead of incrementing
|
|
289
|
+
- `will_validate` (bool) - If true, runs stock/purchase validation
|
|
290
|
+
- `replace` (bool) - If true, removes existing item before adding
|
|
291
|
+
- `remove_args` (array) - Extra args for matching when removing
|
|
292
|
+
- `matched_args` (array) - Extra args for matching existing items
|
|
293
|
+
- `other_info` (array) - Additional info merged into item's `other_info`
|
|
294
|
+
|
|
295
|
+
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
299
|
+
$variation = FluentCart\App\Models\ProductVariation::find(1);
|
|
300
|
+
$cart->addByVariation($variation, ['quantity' => 2, 'will_validate' => true]);
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### addByCustom(array $variation, array $config = [])
|
|
304
|
+
|
|
305
|
+
Add a custom (non-standard) item to the cart. Normalizes the item via `CartHelper::normalizeCustomFields()`, validates required fields (`id`, `object_id`, `post_id`, `post_title`, `price`, `unit_price`, `payment_type`), and rejects subscription items (which must use direct checkout). Uses `CartHelper::generateCartItemCustomItem()` to build the cart item.
|
|
306
|
+
|
|
307
|
+
- Parameters: `$variation` (Array) - Custom item data with required fields
|
|
308
|
+
- `$config` (Array) - Configuration options: `quantity` (int) - Desired quantity (default: 1; 0 removes the item)
|
|
309
|
+
- `remove_args` (array) - Extra args for matching when removing
|
|
310
|
+
- `matched_args` (array) - Extra args for matching existing items
|
|
311
|
+
|
|
312
|
+
Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
316
|
+
$cart->addByCustom([
|
|
317
|
+
'id' => 100,
|
|
318
|
+
'object_id' => 100,
|
|
319
|
+
'post_id' => 50,
|
|
320
|
+
'post_title' => 'Custom Item',
|
|
321
|
+
'price' => 1500,
|
|
322
|
+
'unit_price' => 1500,
|
|
323
|
+
'payment_type' => 'one_time',
|
|
324
|
+
], ['quantity' => 1]);
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### findExistingItemAndIndex($objectId, $extraArgs = [])
|
|
328
|
+
|
|
329
|
+
Find an existing cart item and its index by `object_id`. Optionally matches additional arguments against the item using dot-notation keys.
|
|
330
|
+
|
|
331
|
+
- Parameters: `$objectId` (Integer) - The object ID to search for
|
|
332
|
+
- `$extraArgs` (Array) - Additional key-value pairs to match against the item
|
|
333
|
+
|
|
334
|
+
Returns `Array|null` - `[$index, $item]` tuple if found, or null
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
338
|
+
$result = $cart->findExistingItemAndIndex(100, ['other_info.color' => 'red']);
|
|
339
|
+
if ($result) {
|
|
340
|
+
[$index, $item] = $result;
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Coupon Methods
|
|
345
|
+
|
|
346
|
+
#### applyCoupon($codes = [])
|
|
347
|
+
|
|
348
|
+
Apply coupon codes to the cart. If the cart is locked, returns a `WP_Error`. Creates a `DiscountService` instance to calculate discounts, updates `cart_data`, `coupons`, and `checkout_data.__per_coupon_discounts`, then saves. Fires `fluent_cart/checkout/cart_amount_updated` and `fluent_cart/cart/cart_data_items_updated` actions.
|
|
349
|
+
|
|
350
|
+
- Parameters: `$codes` (Array) - Coupon codes to apply
|
|
351
|
+
- Returns `Mixed` - Discount service result or `WP_Error` if locked/invalid
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
355
|
+
$result = $cart->applyCoupon(['SAVE10', 'WELCOME20']);
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### removeCoupon($removeCodes = [])
|
|
359
|
+
|
|
360
|
+
Remove specific coupon codes from the cart. Accepts a single code string or an array. Re-validates remaining coupons via `DiscountService` and updates `cart_data`, `coupons`, and `checkout_data.__per_coupon_discounts`. If the cart is locked, returns a `WP_Error`.
|
|
361
|
+
|
|
362
|
+
- Parameters: `$removeCodes` (Array|String) - Coupon code(s) to remove
|
|
363
|
+
- Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
367
|
+
$cart->removeCoupon(['SAVE10']);
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### reValidateCoupons()
|
|
371
|
+
|
|
372
|
+
Re-validate all currently applied coupons against the current cart state. Recalculates discounts via `DiscountService`, updates `cart_data`, `coupons`, and `checkout_data.__per_coupon_discounts`. Fires `fluent_cart/checkout/cart_amount_updated` and conditionally fires `fluent_cart/cart/cart_data_items_updated` if discount totals changed.
|
|
373
|
+
|
|
374
|
+
- Returns `FluentCart\App\Models\Cart|WP_Error` - Cart instance or error if locked
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
378
|
+
$cart->reValidateCoupons();
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
#### getDiscountLines($revalidate = false)
|
|
382
|
+
|
|
383
|
+
Get formatted discount line items for all applied coupons. Each line includes coupon ID, code, type, discount amount, formatted price HTML, and formatted title. When only one coupon is applied, sums `coupon_discount` from each cart item. When multiple coupons are applied, reads per-coupon breakdowns from `checkout_data.__per_coupon_discounts`.
|
|
384
|
+
|
|
385
|
+
- Parameters: `$revalidate` (Boolean) - If true, re-applies coupons before calculating (default: false)
|
|
386
|
+
- Returns `Array` - Associative array keyed by coupon code, each containing `id`, `code`, `type`, `discount`, `formatted_discount`, `actual_formatted_discount`, `formatted_title`
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
390
|
+
$discountLines = $cart->getDiscountLines();
|
|
391
|
+
// Example output:
|
|
392
|
+
// ['SAVE10' => ['id' => 1, 'code' => 'SAVE10', 'discount' => 500, ...]]
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Totals & Calculation Methods
|
|
396
|
+
|
|
397
|
+
#### getShippingTotal()
|
|
398
|
+
|
|
399
|
+
Get the shipping total for the cart. Returns 0 if the cart does not require shipping.
|
|
400
|
+
|
|
401
|
+
- Returns `Integer` - Shipping total in cents
|
|
402
|
+
|
|
403
|
+
```
|
|
404
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
405
|
+
$shippingTotal = $cart->getShippingTotal();
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
#### getItemsSubtotal()
|
|
409
|
+
|
|
410
|
+
Get the items subtotal (before discounts) by combining one-time and subscription items via `CheckoutService` and `OrderService::getItemsAmountWithoutDiscount()`.
|
|
411
|
+
|
|
412
|
+
- Returns `Integer` - Items subtotal in cents
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
416
|
+
$subtotal = $cart->getItemsSubtotal();
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
#### getEstimatedTotal($extraAmount = 0)
|
|
420
|
+
|
|
421
|
+
Get the estimated cart total including item totals, fees, shipping, and custom checkout adjustments. The sequence is:
|
|
422
|
+
|
|
423
|
+
1. A **recursion guard** — if a hook calls `getEstimatedTotal()` again, the call falls through to the private raw calculation so hooks run only once.
|
|
424
|
+
2. `do_action('fluent_cart/cart/before_totals_calculation')`.
|
|
425
|
+
3. `apply_filters('fluent_cart/cart/item_dynamic_discount', $cart_data, ...)`, so a filter can rewrite line items before they are priced.
|
|
426
|
+
4. One-time and subscription items are combined via `CheckoutService`, then totalled by `OrderService::getItemsAmountTotal()`.
|
|
427
|
+
5. Fees, shipping, prorate credit and upgrade discounts are applied.
|
|
428
|
+
6. `apply_filters('fluent_cart/cart/estimated_total', ...)`, and the result is floored at 0.
|
|
429
|
+
|
|
430
|
+
- Parameters: `$extraAmount` (Integer) - Extra amount in cents to include (default: 0)
|
|
431
|
+
- Returns `Integer` - Estimated total in cents (minimum 0)
|
|
432
|
+
|
|
433
|
+
```
|
|
434
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
435
|
+
$total = $cart->getEstimatedTotal(1000); // $10.00 extra
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
#### getEstimatedRecurringTotal()
|
|
439
|
+
|
|
440
|
+
Get the estimated recurring total for subscription items only. Sums each subscription item's `subtotal` minus its `recurring_discounts.amount`.
|
|
441
|
+
|
|
442
|
+
- Returns `Integer` - Estimated recurring total in cents
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
446
|
+
$recurringTotal = $cart->getEstimatedRecurringTotal();
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Address Methods
|
|
450
|
+
|
|
451
|
+
#### getBillingAddress()
|
|
452
|
+
|
|
453
|
+
Get the billing address from checkout form data.
|
|
454
|
+
|
|
455
|
+
- Returns `Array` - Associative array with keys: `full_name`, `company`, `address_1`, `address_2`, `city`, `state`, `postcode`, `country`
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
459
|
+
$billing = $cart->getBillingAddress();
|
|
460
|
+
// ['full_name' => 'John Doe', 'company' => '', 'address_1' => '123 Main St', ...]
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### getShippingAddress()
|
|
464
|
+
|
|
465
|
+
Get the shipping address. If the customer opted to ship to a different address (`isShipToDifferent()`), returns the separate shipping address fields from form data. Otherwise, falls back to `getBillingAddress()`.
|
|
466
|
+
|
|
467
|
+
- Returns `Array` - Associative array with keys: `full_name`, `company`, `address_1`, `address_2`, `city`, `state`, `postcode`, `country`
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
471
|
+
$shipping = $cart->getShippingAddress();
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Customer Methods
|
|
475
|
+
|
|
476
|
+
#### guessCustomer()
|
|
477
|
+
|
|
478
|
+
Attempt to find the associated customer by checking (in order): `customer_id`, `user_id`, then `email`. Returns the first matching `Customer` model found, or null if none match.
|
|
479
|
+
|
|
480
|
+
- Returns `FluentCart\App\Models\Customer|null` - Customer instance or null
|
|
481
|
+
|
|
482
|
+
```
|
|
483
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
484
|
+
$customer = $cart->guessCustomer();
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### Action Hook Helper Methods
|
|
488
|
+
|
|
489
|
+
#### addDraftCreatedActions($hooks)
|
|
490
|
+
|
|
491
|
+
Build a response array for actions to execute after a draft order is created. Deduplicates the hooks array.
|
|
492
|
+
|
|
493
|
+
- Parameters: `$hooks` (Array) - Hook identifiers
|
|
494
|
+
- Returns `Array` - `['__after_draft_created_actions__' => [...]]`
|
|
495
|
+
|
|
496
|
+
#### addSuccessActions($hooks)
|
|
497
|
+
|
|
498
|
+
Build a response array for actions to execute on successful checkout. Deduplicates the hooks array.
|
|
499
|
+
|
|
500
|
+
- Parameters: `$hooks` (Array) - Hook identifiers
|
|
501
|
+
- Returns `Array` - `['__on_success_actions__' => [...]]`
|
|
502
|
+
|
|
503
|
+
#### addCartNotices($notices)
|
|
504
|
+
|
|
505
|
+
Build a response array for cart notices to display. Deduplicates by notice `id`.
|
|
506
|
+
|
|
507
|
+
- Parameters: `$notices` (Array) - Array of notice arrays, each with an `id` key
|
|
508
|
+
- Returns `Array` - `['__cart_notices' => [...]]`
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
512
|
+
$actions = $cart->addSuccessActions(['redirect_to_thank_you', 'clear_cart']);
|
|
513
|
+
$notices = $cart->addCartNotices([
|
|
514
|
+
['id' => 'stock_warning', 'message' => 'Limited stock remaining']
|
|
515
|
+
]);
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
## Relations
|
|
519
|
+
|
|
520
|
+
This model has the following relationships that you can use.
|
|
521
|
+
|
|
522
|
+
### customer
|
|
523
|
+
|
|
524
|
+
Access the associated customer (BelongsTo).
|
|
525
|
+
|
|
526
|
+
- Returns `FluentCart\App\Models\Customer`
|
|
527
|
+
- Foreign Key: `customer_id`
|
|
528
|
+
|
|
529
|
+
```
|
|
530
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
531
|
+
$customer = $cart->customer;
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### order
|
|
535
|
+
|
|
536
|
+
Access the associated order (BelongsTo).
|
|
537
|
+
|
|
538
|
+
- Returns `FluentCart\App\Models\Order`
|
|
539
|
+
- Foreign Key: `order_id`
|
|
540
|
+
|
|
541
|
+
```
|
|
542
|
+
$cart = FluentCart\App\Models\Cart::find('cart_hash_123');
|
|
543
|
+
$order = $cart->order;
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
## Scopes
|
|
547
|
+
|
|
548
|
+
This model has the following scopes that you can use.
|
|
549
|
+
|
|
550
|
+
### stageNotCompleted()
|
|
551
|
+
|
|
552
|
+
Get carts where the `stage` column is not `completed`.
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
$carts = FluentCart\App\Models\Cart::stageNotCompleted()->get();
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
## Usage Examples
|
|
559
|
+
|
|
560
|
+
### Creating a Cart
|
|
561
|
+
|
|
562
|
+
The `cart_hash` is auto-generated if not provided:
|
|
563
|
+
|
|
564
|
+
```
|
|
565
|
+
use FluentCart\App\Models\Cart;
|
|
566
|
+
|
|
567
|
+
// Auto-generated cart_hash
|
|
568
|
+
$cart = Cart::create([
|
|
569
|
+
'customer_id' => 1,
|
|
570
|
+
'email' => '[email protected]',
|
|
571
|
+
]);
|
|
572
|
+
|
|
573
|
+
// Or with explicit cart_hash
|
|
574
|
+
$cart = Cart::create([
|
|
575
|
+
'cart_hash' => 'unique_cart_hash_123',
|
|
576
|
+
'customer_id' => 1,
|
|
577
|
+
'email' => '[email protected]',
|
|
578
|
+
]);
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
### Retrieving Carts
|
|
582
|
+
|
|
583
|
+
```
|
|
584
|
+
// Get cart by hash (primary key)
|
|
585
|
+
$cart = Cart::find('cart_hash_123');
|
|
586
|
+
|
|
587
|
+
// Get carts that are not completed
|
|
588
|
+
$carts = Cart::stageNotCompleted()->get();
|
|
589
|
+
|
|
590
|
+
// Get cart with customer eager-loaded
|
|
591
|
+
$cart = Cart::with('customer')->find('cart_hash_123');
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Working with Cart Items
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
$cart = Cart::find('cart_hash_123');
|
|
598
|
+
|
|
599
|
+
// Add by variation with validation
|
|
600
|
+
$variation = \FluentCart\App\Models\ProductVariation::find(1);
|
|
601
|
+
$cart->addByVariation($variation, [
|
|
602
|
+
'quantity' => 2,
|
|
603
|
+
'will_validate' => true,
|
|
604
|
+
]);
|
|
605
|
+
|
|
606
|
+
// Remove an item
|
|
607
|
+
$cart->removeItem($variation->id);
|
|
608
|
+
|
|
609
|
+
// Check totals
|
|
610
|
+
$subtotal = $cart->getItemsSubtotal();
|
|
611
|
+
$total = $cart->getEstimatedTotal();
|
|
612
|
+
$recurringTotal = $cart->getEstimatedRecurringTotal();
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### Working with Coupons
|
|
616
|
+
|
|
617
|
+
```
|
|
618
|
+
$cart = Cart::find('cart_hash_123');
|
|
619
|
+
|
|
620
|
+
// Apply coupons
|
|
621
|
+
$result = $cart->applyCoupon(['SAVE10']);
|
|
622
|
+
|
|
623
|
+
// Get discount lines for display
|
|
624
|
+
$discountLines = $cart->getDiscountLines();
|
|
625
|
+
|
|
626
|
+
// Remove a coupon
|
|
627
|
+
$cart->removeCoupon(['SAVE10']);
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
### Updating a Cart
|
|
631
|
+
|
|
632
|
+
```
|
|
633
|
+
$cart = Cart::find('cart_hash_123');
|
|
634
|
+
$cart->email = '[email protected]';
|
|
635
|
+
$cart->save();
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### Deleting a Cart
|
|
639
|
+
|
|
640
|
+
```
|
|
641
|
+
$cart = Cart::find('cart_hash_123');
|
|
642
|
+
$cart->delete(); // Soft delete
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
---
|