fluentcart-developer 1.1.0 → 1.1.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/CLAUDE.md +22 -22
- package/LICENSE +21 -21
- package/README.md +169 -127
- package/SKILL.md +127 -127
- package/bin/index.js +281 -281
- package/package.json +48 -37
- package/skills/fluentcart-developer/SKILL.md +172 -172
- package/skills/fluentcart-developer/examples/README.md +25 -25
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -32
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -40
- package/skills/fluentcart-developer/examples/sample-custom-addon/fluentcart-custom-addon.php +114 -114
- package/skills/fluentcart-developer/examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php +149 -149
- package/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -38
- package/skills/fluentcart-developer/examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php +62 -62
- package/skills/fluentcart-developer/references/action-hooks-admin-templates.md +787 -787
- package/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -1355
- package/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -266
- package/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -855
- package/skills/fluentcart-developer/references/action-hooks-orders.md +631 -631
- package/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -963
- package/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -585
- package/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -661
- package/skills/fluentcart-developer/references/database-models-query-builder.md +194 -194
- package/skills/fluentcart-developer/references/database-models-reference.md +604 -604
- package/skills/fluentcart-developer/references/database-schema-reference.md +940 -940
- package/skills/fluentcart-developer/references/engineering-notes.md +154 -154
- package/skills/fluentcart-developer/references/fee-system-guide.md +449 -449
- package/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -1202
- package/skills/fluentcart-developer/references/filter-hooks-customers-subscriptions.md +902 -902
- package/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -1598
- package/skills/fluentcart-developer/references/filter-hooks-orders-payments.md +1319 -1319
- package/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -628
- package/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -1177
- package/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -154
- package/skills/fluentcart-developer/references/ghost-product-selling.md +458 -458
- package/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -224
- package/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -761
- package/skills/fluentcart-developer/references/rest-api-checkout.md +286 -286
- package/skills/fluentcart-developer/references/rest-api-coupons.md +794 -794
- package/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -190
- package/skills/fluentcart-developer/references/rest-api-customers.md +1121 -1121
- package/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -219
- package/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -619
- package/skills/fluentcart-developer/references/rest-api-files.md +290 -290
- package/skills/fluentcart-developer/references/rest-api-integrations.md +324 -324
- package/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -321
- package/skills/fluentcart-developer/references/rest-api-licensing.md +171 -171
- package/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -200
- package/skills/fluentcart-developer/references/rest-api-orders.md +1241 -1241
- package/skills/fluentcart-developer/references/rest-api-overview.md +131 -131
- package/skills/fluentcart-developer/references/rest-api-products.md +2563 -2563
- package/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -172
- package/skills/fluentcart-developer/references/rest-api-reference.md +552 -552
- package/skills/fluentcart-developer/references/rest-api-reports.md +377 -377
- package/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -147
- package/skills/fluentcart-developer/references/rest-api-settings.md +528 -528
- package/skills/fluentcart-developer/references/rest-api-shipping.md +799 -799
- package/skills/fluentcart-developer/references/rest-api-subscriptions.md +606 -606
- package/skills/fluentcart-developer/references/rest-api-tax.md +356 -356
- package/skills/fluentcart-developer/references/subscription-customization.md +197 -197
- package/skills/fluentcart-developer/scripts/cli.js +1 -1
- package/.gitattributes +0 -2
- package/CONTRIBUTING.md +0 -73
- package/copy-skills.js +0 -43
- package/skills.sh.json +0 -13
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Plugin Name: FluentCart Custom Shipping Carrier Example
|
|
4
|
-
* Plugin URI: https://github.com/atifjubaer/skills
|
|
5
|
-
* Description: Example plugin demonstrating how to register custom dynamic shipping calculation methods in FluentCart.
|
|
6
|
-
* Version: 1.0.0
|
|
7
|
-
* Author: Fastrsoft
|
|
8
|
-
* License: MIT
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
if (!defined('ABSPATH')) {
|
|
12
|
-
exit; // Exit if direct file access is attempted
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Hook into FluentCart shipping rate registration filter
|
|
16
|
-
add_filter('fluent_cart/shipping/methods', function($methods) {
|
|
17
|
-
// Append custom carrier calculation class or handler
|
|
18
|
-
$methods['custom_express_carrier'] = [
|
|
19
|
-
'title' => __('Custom Express Carrier', 'fluentcart'),
|
|
20
|
-
'description' => __('Calculates real-time express shipping rates based on cart total and weight.', 'fluentcart'),
|
|
21
|
-
'callback' => 'fluentcart_calculate_express_shipping_rate'
|
|
22
|
-
];
|
|
23
|
-
return $methods;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// Callback function to calculate dynamic shipping rate for current cart
|
|
27
|
-
function fluentcart_calculate_express_shipping_rate($cartData) {
|
|
28
|
-
// Extract subtotal and item total weights from cart data object
|
|
29
|
-
$subtotal = $cartData['subtotal'] ?? 0;
|
|
30
|
-
$totalWeight = $cartData['total_weight'] ?? 0; // Total weight in kg
|
|
31
|
-
|
|
32
|
-
// Set base shipping fee
|
|
33
|
-
$baseRate = 500; // $5.00 in cents
|
|
34
|
-
|
|
35
|
-
// Apply free shipping logic for high subtotal orders over $100 (10000 cents)
|
|
36
|
-
if ($subtotal >= 10000) {
|
|
37
|
-
return [
|
|
38
|
-
'id' => 'custom_express_free',
|
|
39
|
-
'title' => __('Express Shipping (Free - Order > $100)', 'fluentcart'),
|
|
40
|
-
'cost' => 0, // Free rate
|
|
41
|
-
'delivery' => __('1-2 Business Days', 'fluentcart')
|
|
42
|
-
];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Calculate weight-based surcharge ($2 per extra kg over 1kg)
|
|
46
|
-
$weightSurcharge = 0;
|
|
47
|
-
if ($totalWeight > 1) {
|
|
48
|
-
$extraKg = ceil($totalWeight - 1);
|
|
49
|
-
$weightSurcharge = $extraKg * 200; // $2.00 per extra kg
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Sum total shipping cost in store currency cents
|
|
53
|
-
$finalCost = $baseRate + $weightSurcharge;
|
|
54
|
-
|
|
55
|
-
// Return shipping rate item payload
|
|
56
|
-
return [
|
|
57
|
-
'id' => 'custom_express_rate',
|
|
58
|
-
'title' => __('Express Delivery', 'fluentcart'),
|
|
59
|
-
'cost' => $finalCost, // Amount in monetary cents
|
|
60
|
-
'delivery' => __('1-2 Business Days', 'fluentcart')
|
|
61
|
-
];
|
|
62
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: FluentCart Custom Shipping Carrier Example
|
|
4
|
+
* Plugin URI: https://github.com/atifjubaer/skills
|
|
5
|
+
* Description: Example plugin demonstrating how to register custom dynamic shipping calculation methods in FluentCart.
|
|
6
|
+
* Version: 1.0.0
|
|
7
|
+
* Author: Fastrsoft
|
|
8
|
+
* License: MIT
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
if (!defined('ABSPATH')) {
|
|
12
|
+
exit; // Exit if direct file access is attempted
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Hook into FluentCart shipping rate registration filter
|
|
16
|
+
add_filter('fluent_cart/shipping/methods', function($methods) {
|
|
17
|
+
// Append custom carrier calculation class or handler
|
|
18
|
+
$methods['custom_express_carrier'] = [
|
|
19
|
+
'title' => __('Custom Express Carrier', 'fluentcart'),
|
|
20
|
+
'description' => __('Calculates real-time express shipping rates based on cart total and weight.', 'fluentcart'),
|
|
21
|
+
'callback' => 'fluentcart_calculate_express_shipping_rate'
|
|
22
|
+
];
|
|
23
|
+
return $methods;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Callback function to calculate dynamic shipping rate for current cart
|
|
27
|
+
function fluentcart_calculate_express_shipping_rate($cartData) {
|
|
28
|
+
// Extract subtotal and item total weights from cart data object
|
|
29
|
+
$subtotal = $cartData['subtotal'] ?? 0;
|
|
30
|
+
$totalWeight = $cartData['total_weight'] ?? 0; // Total weight in kg
|
|
31
|
+
|
|
32
|
+
// Set base shipping fee
|
|
33
|
+
$baseRate = 500; // $5.00 in cents
|
|
34
|
+
|
|
35
|
+
// Apply free shipping logic for high subtotal orders over $100 (10000 cents)
|
|
36
|
+
if ($subtotal >= 10000) {
|
|
37
|
+
return [
|
|
38
|
+
'id' => 'custom_express_free',
|
|
39
|
+
'title' => __('Express Shipping (Free - Order > $100)', 'fluentcart'),
|
|
40
|
+
'cost' => 0, // Free rate
|
|
41
|
+
'delivery' => __('1-2 Business Days', 'fluentcart')
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Calculate weight-based surcharge ($2 per extra kg over 1kg)
|
|
46
|
+
$weightSurcharge = 0;
|
|
47
|
+
if ($totalWeight > 1) {
|
|
48
|
+
$extraKg = ceil($totalWeight - 1);
|
|
49
|
+
$weightSurcharge = $extraKg * 200; // $2.00 per extra kg
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Sum total shipping cost in store currency cents
|
|
53
|
+
$finalCost = $baseRate + $weightSurcharge;
|
|
54
|
+
|
|
55
|
+
// Return shipping rate item payload
|
|
56
|
+
return [
|
|
57
|
+
'id' => 'custom_express_rate',
|
|
58
|
+
'title' => __('Express Delivery', 'fluentcart'),
|
|
59
|
+
'cost' => $finalCost, // Amount in monetary cents
|
|
60
|
+
'delivery' => __('1-2 Business Days', 'fluentcart')
|
|
61
|
+
];
|
|
62
|
+
}
|