Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Disable quantity selector and remove item link if item is a synced force sell #5745

Closed
wants to merge 1 commit into from
Closed
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 @@ -200,6 +200,12 @@ const CartLineItemRow = forwardRef< HTMLTableRowElement, CartLineItemRowProps >(
validation: productPriceValidation,
} );

// If this item is set as a Sync Force Sell (by the Woocommerce Force Sells plugin).
// we want to disable the quantity selector and remove item link
const isSyncForcedItem = !! itemData.find(
( item ) => item?.name === 'Linked to'
);

return (
<tr
className={ classnames(
Expand Down Expand Up @@ -288,7 +294,9 @@ const CartLineItemRow = forwardRef< HTMLTableRowElement, CartLineItemRowProps >(
{ ! soldIndividually &&
!! quantityLimits.editable && (
<QuantitySelector
disabled={ isPendingDelete }
disabled={
isPendingDelete || isSyncForcedItem
}
quantity={ quantity }
minimum={ quantityLimits.minimum }
maximum={ quantityLimits.maximum }
Expand Down Expand Up @@ -326,7 +334,7 @@ const CartLineItemRow = forwardRef< HTMLTableRowElement, CartLineItemRowProps >(
)
);
} }
disabled={ isPendingDelete }
disabled={ isPendingDelete || isSyncForcedItem }
>
{ __(
'Remove item',
Expand Down