feat: add custom/not_specified shipping modes with cost input for ML publish

- build_item_payload supports shipping_cost for custom mode with costs array
- Add shipping mode selector: me2, custom, not_specified
- Show shipping cost input when custom is selected
- Backend passes shipping_cost through custom_data to payload builder
This commit is contained in:
2026-05-26 06:32:21 +00:00
parent 314075021e
commit 584cc385b9
3 changed files with 31 additions and 7 deletions

View File

@@ -993,9 +993,20 @@
}
});
window.onMeliShippingChange = function() {
var mode = document.getElementById('meliShippingMode').value;
var costField = document.getElementById('meliShippingCostField');
if (costField) costField.style.display = (mode === 'custom') ? 'block' : 'none';
};
function _collectMeliCustomData() {
var ids = Array.from(selectedItems);
var customData = { titles: {}, prices: {}, stocks: {}, attributes: {} };
var mode = document.getElementById('meliShippingMode').value;
if (mode === 'custom') {
var costEl = document.getElementById('meliShippingCost');
if (costEl) customData.shipping_cost = parseFloat(costEl.value) || 0;
}
ids.forEach(function(id) {
var titleEl = document.getElementById('meliTitle-' + id);
var priceEl = document.getElementById('meliPrice-' + id);