Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ server.post('UpdateOptions', function (req, res, next) {
}

basket.custom.subproSubscriptionsToBeProcessed = isSubpro;
basket.custom.subproContainsSubscriptions = isSubpro;

res.json(new CartModel(basket));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
{
"name": "dw.ocapi.shop.order.validateOrder",
"script": "./hooks/order.js"
},
{
"name": "dw.ocapi.shop.basket.afterPost",
"script": "./hooks/basket.js"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var Status = require('dw/system/Status');

/**
* afterPost
* @param {dw.order.Basket} basket - basket
* @returns {Status} a non-null Status ends the hook execution
*/
function afterPost(basket) {
if (basket.custom.subproIsRecurringOrder) {
basket.custom.subproContainsSubscriptions = true;
}

return new Status(Status.OK);
}

module.exports = {
afterPost: afterPost
};
Binary file modified metadata/site_import.zip
Binary file not shown.
8 changes: 8 additions & 0 deletions metadata/site_import/meta/system-objecttype-extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,20 @@
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
</attribute-definition>
<attribute-definition attribute-id="subproIsRecurringOrder">
<display-name xml:lang="x-default">Subpro Is Recurring Order</display-name>
<type>boolean</type>
<localizable-flag>false</localizable-flag>
<mandatory-flag>false</mandatory-flag>
<externally-managed-flag>false</externally-managed-flag>
</attribute-definition>
</custom-attribute-definitions>
<group-definitions>
<attribute-group group-id="subscribe-pro">
<display-name xml:lang="x-default">Subscribe Pro</display-name>
<attribute attribute-id="subproContainsSubscriptions"/>
<attribute attribute-id="subproSubscriptionsToBeProcessed"/>
<attribute attribute-id="subproIsRecurringOrder"/>
</attribute-group>
</group-definitions>
</type-extension>
Expand Down