<!-- prettier-ignore-start -->
# Class PriceAdjustment

- [TopLevel.Object](TopLevel.Object.md)
  - [dw.object.PersistentObject](dw.object.PersistentObject.md)
    - [dw.object.ExtensibleObject](dw.object.ExtensibleObject.md)
      - [dw.order.LineItem](dw.order.LineItem.md)
        - [dw.order.PriceAdjustment](dw.order.PriceAdjustment.md)

The PriceAdjustment class represents an adjustment to the price of an order. A PriceAdjustment can apply to a
ProductLineItem, ShippingLineItem, ProductShippingLineItem, or a LineItemCtnr, and are generally categorized as
product-level, shipping-level, or order-level. PriceAdjustments are generated by the B2C Commerce promotions engine
when applying discounts. See [PromotionMgr.applyDiscounts(DiscountPlan)](dw.campaign.PromotionMgr.md#applydiscountsdiscountplan). They may also be
generated by custom code through the API. See for example
[ProductLineItem.createPriceAdjustment(String)](dw.order.ProductLineItem.md#createpriceadjustmentstring). In the latter case, the PriceAdjustment is called
"custom"; in the former case, it is called "system". System price adjustments are associated with the promotion that
triggered their creation. If the promotion was coupon-based, then the price adjustment will additionally be
associated with a coupon line item in the LineItemCtnr.



## Property Summary

| Property | Description |
| --- | --- |
| [ABTest](#abtest): [ABTest](dw.campaign.ABTest.md) `(read-only)` | Returns the B2C Commerce AB-test this price adjustment is associated with. |
| [ABTestID](#abtestid): [String](TopLevel.String.md) `(read-only)` | Returns the ID of the AB-test related to this price adjustment. |
| [ABTestSegment](#abtestsegment): [ABTestSegment](dw.campaign.ABTestSegment.md) `(read-only)` | Returns the B2C Commerce AB-test segment this price adjustment is associated with. |
| [ABTestSegmentID](#abtestsegmentid): [String](TopLevel.String.md) `(read-only)` | Returns the ID of the AB-test segment related to this price adjustment. |
| [appliedDiscount](#applieddiscount): [Discount](dw.campaign.Discount.md) `(read-only)` | A `Discount` instance describing the discount applied to  obtain this price-adjustment. |
| [basedOnABTest](#basedonabtest): [Boolean](TopLevel.Boolean.md) `(read-only)` | Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a  promotion assigned to an AB-test. |
| ~~[basedOnCampaign](#basedoncampaign): [Boolean](TopLevel.Boolean.md)~~ `(read-only)` | Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a  promotion assigned to a Campaign or an AB-test. |
| [basedOnCoupon](#basedoncoupon): [Boolean](TopLevel.Boolean.md) `(read-only)` | Identifies if the promotion line item results from a coupon. |
| [campaign](#campaign): [Campaign](dw.campaign.Campaign.md) `(read-only)` | Returns the B2C Commerce campaign this price adjustment is associated with. |
| [campaignID](#campaignid): [String](TopLevel.String.md) `(read-only)` | Returns the ID of the campaign the price adjustment was based on. |
| [couponLineItem](#couponlineitem): [CouponLineItem](dw.order.CouponLineItem.md) `(read-only)` | Returns the coupon line item related to this price adjustment. |
| [createdBy](#createdby): [String](TopLevel.String.md) `(read-only)` | Returns the name of the user who created the price adjustment. |
| [custom](#custom): [Boolean](TopLevel.Boolean.md) `(read-only)` | Returns true if this PriceAdjustment was created by custom script code. |
| [manual](#manual): [Boolean](TopLevel.Boolean.md) | Returns true if this PriceAdjustment was added manually by a user. |
| [promotion](#promotion): [Promotion](dw.campaign.Promotion.md) `(read-only)` | Returns the promotion associated with this price adjustment. |
| [promotionID](#promotionid): [String](TopLevel.String.md) `(read-only)` | Returns the ID of the promotion related to this price adjustment. |
| [proratedPrices](#proratedprices): [Map](dw.util.Map.md) `(read-only)` | Returns a map representing the product line items to which this price  adjustment is "related" (in the sense defined below) and the portion of  this adjustment's price which applies to each after discount prorating is  performed. |
| [quantity](#quantity): [Number](TopLevel.Number.md) `(read-only)` | Returns the number of items this price adjustment applies to. |
| [reasonCode](#reasoncode): [EnumValue](dw.value.EnumValue.md) | Returns the reason code of the price adjustment. |

## Constructor Summary

This class does not have a constructor, so you cannot create it directly.
## Method Summary

| Method | Description |
| --- | --- |
| [getABTest](dw.order.PriceAdjustment.md#getabtest)() | Returns the B2C Commerce AB-test this price adjustment is associated with. |
| [getABTestID](dw.order.PriceAdjustment.md#getabtestid)() | Returns the ID of the AB-test related to this price adjustment. |
| [getABTestSegment](dw.order.PriceAdjustment.md#getabtestsegment)() | Returns the B2C Commerce AB-test segment this price adjustment is associated with. |
| [getABTestSegmentID](dw.order.PriceAdjustment.md#getabtestsegmentid)() | Returns the ID of the AB-test segment related to this price adjustment. |
| [getAppliedDiscount](dw.order.PriceAdjustment.md#getapplieddiscount)() | A `Discount` instance describing the discount applied to  obtain this price-adjustment. |
| [getCampaign](dw.order.PriceAdjustment.md#getcampaign)() | Returns the B2C Commerce campaign this price adjustment is associated with. |
| [getCampaignID](dw.order.PriceAdjustment.md#getcampaignid)() | Returns the ID of the campaign the price adjustment was based on. |
| [getCouponLineItem](dw.order.PriceAdjustment.md#getcouponlineitem)() | Returns the coupon line item related to this price adjustment. |
| [getCreatedBy](dw.order.PriceAdjustment.md#getcreatedby)() | Returns the name of the user who created the price adjustment. |
| [getPromotion](dw.order.PriceAdjustment.md#getpromotion)() | Returns the promotion associated with this price adjustment. |
| [getPromotionID](dw.order.PriceAdjustment.md#getpromotionid)() | Returns the ID of the promotion related to this price adjustment. |
| [getProratedPrices](dw.order.PriceAdjustment.md#getproratedprices)() | Returns a map representing the product line items to which this price  adjustment is "related" (in the sense defined below) and the portion of  this adjustment's price which applies to each after discount prorating is  performed. |
| [getQuantity](dw.order.PriceAdjustment.md#getquantity)() | Returns the number of items this price adjustment applies to. |
| [getReasonCode](dw.order.PriceAdjustment.md#getreasoncode)() | Returns the reason code of the price adjustment. |
| [isBasedOnABTest](dw.order.PriceAdjustment.md#isbasedonabtest)() | Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a  promotion assigned to an AB-test. |
| ~~[isBasedOnCampaign](dw.order.PriceAdjustment.md#isbasedoncampaign)()~~ | Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a  promotion assigned to a Campaign or an AB-test. |
| [isBasedOnCoupon](dw.order.PriceAdjustment.md#isbasedoncoupon)() | Identifies if the promotion line item results from a coupon. |
| [isCustom](dw.order.PriceAdjustment.md#iscustom)() | Returns true if this PriceAdjustment was created by custom script code. |
| [isManual](dw.order.PriceAdjustment.md#ismanual)() | Returns true if this PriceAdjustment was added manually by a user. |
| [setManual](dw.order.PriceAdjustment.md#setmanualboolean)([Boolean](TopLevel.Boolean.md)) | Marks the current PriceAdjustment as manual/non-manual. |
| [setReasonCode](dw.order.PriceAdjustment.md#setreasoncodestring)([String](TopLevel.String.md)) | Set the reason code, using the internal non-localizable value. |

### Methods inherited from class LineItem

[getBasePrice](dw.order.LineItem.md#getbaseprice), [getGrossPrice](dw.order.LineItem.md#getgrossprice), [getLineItemCtnr](dw.order.LineItem.md#getlineitemctnr), [getLineItemText](dw.order.LineItem.md#getlineitemtext), [getNetPrice](dw.order.LineItem.md#getnetprice), [getPrice](dw.order.LineItem.md#getprice), [getPriceValue](dw.order.LineItem.md#getpricevalue), [getTax](dw.order.LineItem.md#gettax), [getTaxBasis](dw.order.LineItem.md#gettaxbasis), [getTaxClassID](dw.order.LineItem.md#gettaxclassid), [getTaxRate](dw.order.LineItem.md#gettaxrate), [setBasePrice](dw.order.LineItem.md#setbasepricemoney), [setGrossPrice](dw.order.LineItem.md#setgrosspricemoney), [setLineItemText](dw.order.LineItem.md#setlineitemtextstring), [setNetPrice](dw.order.LineItem.md#setnetpricemoney), [setPriceValue](dw.order.LineItem.md#setpricevaluenumber), [setTax](dw.order.LineItem.md#settaxmoney), [setTaxClassID](dw.order.LineItem.md#settaxclassidstring), [setTaxRate](dw.order.LineItem.md#settaxratenumber), [updatePrice](dw.order.LineItem.md#updatepricemoney), [updateTax](dw.order.LineItem.md#updatetaxnumber), [updateTax](dw.order.LineItem.md#updatetaxnumber-money), [updateTaxAmount](dw.order.LineItem.md#updatetaxamountmoney)
### Methods inherited from class ExtensibleObject

[describe](dw.object.ExtensibleObject.md#describe), [getCustom](dw.object.ExtensibleObject.md#getcustom)
### Methods inherited from class PersistentObject

[getCreationDate](dw.object.PersistentObject.md#getcreationdate), [getLastModified](dw.object.PersistentObject.md#getlastmodified), [getUUID](dw.object.PersistentObject.md#getuuid)
### Methods inherited from class Object

[assign](TopLevel.Object.md#assignobject-object), [create](TopLevel.Object.md#createobject), [create](TopLevel.Object.md#createobject-object), [defineProperties](TopLevel.Object.md#definepropertiesobject-object), [defineProperty](TopLevel.Object.md#definepropertyobject-object-object), [entries](TopLevel.Object.md#entriesobject), [freeze](TopLevel.Object.md#freezeobject), [fromEntries](TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](TopLevel.Object.md#hasownpropertystring), [is](TopLevel.Object.md#isobject-object), [isExtensible](TopLevel.Object.md#isextensibleobject), [isFrozen](TopLevel.Object.md#isfrozenobject), [isPrototypeOf](TopLevel.Object.md#isprototypeofobject), [isSealed](TopLevel.Object.md#issealedobject), [keys](TopLevel.Object.md#keysobject), [preventExtensions](TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](TopLevel.Object.md#propertyisenumerablestring), [seal](TopLevel.Object.md#sealobject), [setPrototypeOf](TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](TopLevel.Object.md#tolocalestring), [toString](TopLevel.Object.md#tostring), [valueOf](TopLevel.Object.md#valueof), [values](TopLevel.Object.md#valuesobject)
## Property Details

### ABTest
- ABTest: [ABTest](dw.campaign.ABTest.md) `(read-only)`
  - : Returns the B2C Commerce AB-test this price adjustment is associated with. The associated AB-test is determined
      from the ABTestID attribute which is set by the promotions engine when applying discounts.
      
      
      If the AB-test has been removed from the system since this price adjustment was created, this method returns
      null. This method always returns null for custom price adjustments.



---

### ABTestID
- ABTestID: [String](TopLevel.String.md) `(read-only)`
  - : Returns the ID of the AB-test related to this price adjustment.


---

### ABTestSegment
- ABTestSegment: [ABTestSegment](dw.campaign.ABTestSegment.md) `(read-only)`
  - : Returns the B2C Commerce AB-test segment this price adjustment is associated with. The associated AB-test segment
      is determined from the ABTestSegmentID attribute which is set by the promotions engine when applying discounts.
      
      
      If the AB-test, or this segment, has been removed from the system since this price adjustment was created, this
      method returns null. This method always returns null for custom price adjustments.



---

### ABTestSegmentID
- ABTestSegmentID: [String](TopLevel.String.md) `(read-only)`
  - : Returns the ID of the AB-test segment related to this price adjustment.


---

### appliedDiscount
- appliedDiscount: [Discount](dw.campaign.Discount.md) `(read-only)`
  - : A `Discount` instance describing the discount applied to
      obtain this price-adjustment. This method only returns a non-null value
      if the price-adjustment was created
      
      - when a discount-plan was applied to a basket, or
      - as a _custom_price-adjustment using one of the methods  [ProductLineItem.createPriceAdjustment(String, Discount)](dw.order.ProductLineItem.md#createpriceadjustmentstring-discount),  [ShippingLineItem.createShippingPriceAdjustment(String, Discount)](dw.order.ShippingLineItem.md#createshippingpriceadjustmentstring-discount)or [LineItemCtnr.createPriceAdjustment(String, Discount)](dw.order.LineItemCtnr.md#createpriceadjustmentstring-discount).  
      
      
       Note an instance of the [Discount](dw.campaign.Discount.md) subclasses is
      returned, such as [AmountDiscount](dw.campaign.AmountDiscount.md) or
      [PriceBookPriceDiscount](dw.campaign.PriceBookPriceDiscount.md), use
      [Discount.getType()](dw.campaign.Discount.md#gettype) and the constants in
      [Discount](dw.campaign.Discount.md) to distinguish between types. Each subclass
      provides access to specific properties.



---

### basedOnABTest
- basedOnABTest: [Boolean](TopLevel.Boolean.md) `(read-only)`
  - : Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a
      promotion assigned to an AB-test.



---

### basedOnCampaign
- ~~basedOnCampaign: [Boolean](TopLevel.Boolean.md)~~ `(read-only)`
  - : Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a
      promotion assigned to a Campaign or an AB-test.


    **Deprecated:**
:::warning
The method has been deprecated since the name implies that there is a related Campaign, which may not
            be true. Use `!isCustom()` instead.

:::

---

### basedOnCoupon
- basedOnCoupon: [Boolean](TopLevel.Boolean.md) `(read-only)`
  - : Identifies if the promotion line item results from a coupon.


---

### campaign
- campaign: [Campaign](dw.campaign.Campaign.md) `(read-only)`
  - : Returns the B2C Commerce campaign this price adjustment is associated with. The associated campaign is determined
      from the campaignID attribute which is set by the promotions engine when applying discounts.
      
      
      If the campaign has been removed from the system since this price adjustment was created, this method returns
      null. This method always returns null for custom price adjustments.
      
      
      Note: If the price adjustment was generated by a B2C Commerce promotion as part of an AB-test, then a Campaign
      object will be returned, but it is a mock implementation, and not a true Campaign. This behavior is required for
      backwards compatibility and should not be relied upon as it may change in future releases.



---

### campaignID
- campaignID: [String](TopLevel.String.md) `(read-only)`
  - : Returns the ID of the campaign the price adjustment was based on.
      
      
      Note:If the price adjustment was generated by a B2C Commerce promotion as part of an AB-test, then an ID will be
      returned but it is not the ID of a true campaign. This behavior is required for backwards compatibility and
      should not be relied upon as it may change in future releases.



---

### couponLineItem
- couponLineItem: [CouponLineItem](dw.order.CouponLineItem.md) `(read-only)`
  - : Returns the coupon line item related to this price adjustment.
      If the price adjustment is not based on a coupon, null is returned.



---

### createdBy
- createdBy: [String](TopLevel.String.md) `(read-only)`
  - : Returns the name of the user who created the price adjustment.
      This method returns a value if the price-adjustment was
      created as a _custom_ price-adjustment using one of the methods
      [ProductLineItem.createPriceAdjustment(String, Discount)](dw.order.ProductLineItem.md#createpriceadjustmentstring-discount),
      [ShippingLineItem.createShippingPriceAdjustment(String, Discount)](dw.order.ShippingLineItem.md#createshippingpriceadjustmentstring-discount)
      or [LineItemCtnr.createPriceAdjustment(String, Discount)](dw.order.LineItemCtnr.md#createpriceadjustmentstring-discount).
      
      
      If an agent user has created the price adjustment, the agent user's name
      is returned. Otherwise "Customer" is returned.



---

### custom
- custom: [Boolean](TopLevel.Boolean.md) `(read-only)`
  - : Returns true if this PriceAdjustment was created by custom script code.


---

### manual
- manual: [Boolean](TopLevel.Boolean.md)
  - : Returns true if this PriceAdjustment was added manually by a user.
      
      
      A manual PriceAdjustment is one which has been added as a result of
      a user interaction e.g. by a user editing an order.
      
      
      A non-manual PriceAdjustment is one which has been added for a different
      reason, e.g. by custom logic which automatically adjusts the price of
      particular products when certain conditions are met.



---

### promotion
- promotion: [Promotion](dw.campaign.Promotion.md) `(read-only)`
  - : Returns the promotion associated with this price adjustment. The
      associated promotion is determined from the promotionID and campaignID
      attributes which are set by the promotions engine when applying
      discounts. Alternatively if the promotion applied as part of an AB-test,
      then the associated promotion is determined from the promotionID
      attribute and the hidden attributes, abTestID and abTestGroupID.
      
      
      If the promotion has been removed from the system since this price
      adjustment was created, or if the promotion still exists but is not
      assigned to any campaign or AB-test, this method returns null. If the
      promotion has been reassigned to a different campaign or AB-test since
      this price adjustment was created, then the system will return an
      appropriate Promotion instance. This method always returns null for
      custom price adjustments.



---

### promotionID
- promotionID: [String](TopLevel.String.md) `(read-only)`
  - : Returns the ID of the promotion related to this price adjustment.


---

### proratedPrices
- proratedPrices: [Map](dw.util.Map.md) `(read-only)`
  - : Returns a map representing the product line items to which this price
      adjustment is "related" (in the sense defined below) and the portion of
      this adjustment's price which applies to each after discount prorating is
      performed. This information is sometimes useful to display in the
      storefront but is more often useful for integrating with backend
      order-management and accounting systems which require all discounts to be
      itemized.
      
      
      The definition of "related" product line items depends on the type of
      promotion which generated this price adjustment:
      
      
      - For order promotions, price adjustments are prorated across all  product line items which are not explicitly excluded by the promotion.  Custom order price adjustments apply to all items in the LineItemCtnr.
      - For Buy-X-Get-Y product promotions, price adjustments are prorated  across all items all product line items that are involved in the  promotion, meaning that the PLI has one or more items contributing to the  qualifying product count (i.e. the item is one of the X) or receiving the  discount (i.e. the item is one of the Y).
      - Other product promotions are not prorated and simply adjust the  parent product line item, and so the returned map is of size 1.
      - For shipping promotions, this method returns an empty map.
      
      
      Buy-X-Get-Y product promotions are prorated as follows: Each price
      adjustment generated by the promotion is sequentially prorated upon the
      related items according to the items' adjusted prices after all non-BOGO
      product promotions are considered, but before order promotions are
      considered.
      
      
      Order promotions are prorated sequentially upon non-excluded items
      according to the order in which they applied during promotion processing.
      
      
      The values in the map are inclusive of tax if this price adjustment is
      based on gross pricing, and exclusive of tax otherwise. The sum of the
      prorated prices always equals the price of this price adjustment.



---

### quantity
- quantity: [Number](TopLevel.Number.md) `(read-only)`
  - : Returns the number of items this price adjustment applies to. This value
      is always equal to 1 for price adjustments generated by order or shipping
      promotions. For price adjustments generated by product promotions, this
      value represents the number of units of the parent product line item to
      which the adjustment applies. Because promotions may have a maximum
      number of applications this value may be less than the product line item
      quantity.
      
      
      For custom price adjustments, not generated by the promotions engine,
      this method always returns 0.



---

### reasonCode
- reasonCode: [EnumValue](dw.value.EnumValue.md)
  - : Returns the reason code of the price adjustment. The list of available
      reason codes is editable system meta-data. An example for using the
      reason code is that in a call center application the CSR will explain
      why he gave a discount to the customer.



---

## Method Details

### getABTest()
- getABTest(): [ABTest](dw.campaign.ABTest.md)
  - : Returns the B2C Commerce AB-test this price adjustment is associated with. The associated AB-test is determined
      from the ABTestID attribute which is set by the promotions engine when applying discounts.
      
      
      If the AB-test has been removed from the system since this price adjustment was created, this method returns
      null. This method always returns null for custom price adjustments.


    **Returns:**
    - the B2C Commerce AB-test the price adjustment was based on, or `null` if it was not based on
              an AB-test.



---

### getABTestID()
- getABTestID(): [String](TopLevel.String.md)
  - : Returns the ID of the AB-test related to this price adjustment.

    **Returns:**
    - ID of related AB-test, or null.


---

### getABTestSegment()
- getABTestSegment(): [ABTestSegment](dw.campaign.ABTestSegment.md)
  - : Returns the B2C Commerce AB-test segment this price adjustment is associated with. The associated AB-test segment
      is determined from the ABTestSegmentID attribute which is set by the promotions engine when applying discounts.
      
      
      If the AB-test, or this segment, has been removed from the system since this price adjustment was created, this
      method returns null. This method always returns null for custom price adjustments.


    **Returns:**
    - the B2C Commerce AB-test segment the price adjustment was based on, or `null` if it was not
              based on an AB-test.



---

### getABTestSegmentID()
- getABTestSegmentID(): [String](TopLevel.String.md)
  - : Returns the ID of the AB-test segment related to this price adjustment.

    **Returns:**
    - ID of related AB-test segment, or null.


---

### getAppliedDiscount()
- getAppliedDiscount(): [Discount](dw.campaign.Discount.md)
  - : A `Discount` instance describing the discount applied to
      obtain this price-adjustment. This method only returns a non-null value
      if the price-adjustment was created
      
      - when a discount-plan was applied to a basket, or
      - as a _custom_price-adjustment using one of the methods  [ProductLineItem.createPriceAdjustment(String, Discount)](dw.order.ProductLineItem.md#createpriceadjustmentstring-discount),  [ShippingLineItem.createShippingPriceAdjustment(String, Discount)](dw.order.ShippingLineItem.md#createshippingpriceadjustmentstring-discount)or [LineItemCtnr.createPriceAdjustment(String, Discount)](dw.order.LineItemCtnr.md#createpriceadjustmentstring-discount).  
      
      
       Note an instance of the [Discount](dw.campaign.Discount.md) subclasses is
      returned, such as [AmountDiscount](dw.campaign.AmountDiscount.md) or
      [PriceBookPriceDiscount](dw.campaign.PriceBookPriceDiscount.md), use
      [Discount.getType()](dw.campaign.Discount.md#gettype) and the constants in
      [Discount](dw.campaign.Discount.md) to distinguish between types. Each subclass
      provides access to specific properties.


    **Returns:**
    - null or the discount applied


---

### getCampaign()
- getCampaign(): [Campaign](dw.campaign.Campaign.md)
  - : Returns the B2C Commerce campaign this price adjustment is associated with. The associated campaign is determined
      from the campaignID attribute which is set by the promotions engine when applying discounts.
      
      
      If the campaign has been removed from the system since this price adjustment was created, this method returns
      null. This method always returns null for custom price adjustments.
      
      
      Note: If the price adjustment was generated by a B2C Commerce promotion as part of an AB-test, then a Campaign
      object will be returned, but it is a mock implementation, and not a true Campaign. This behavior is required for
      backwards compatibility and should not be relied upon as it may change in future releases.


    **Returns:**
    - the B2C Commerce campaign the price adjustment was based on, or `null` if it was not based on
              a campaign.



---

### getCampaignID()
- getCampaignID(): [String](TopLevel.String.md)
  - : Returns the ID of the campaign the price adjustment was based on.
      
      
      Note:If the price adjustment was generated by a B2C Commerce promotion as part of an AB-test, then an ID will be
      returned but it is not the ID of a true campaign. This behavior is required for backwards compatibility and
      should not be relied upon as it may change in future releases.


    **Returns:**
    - the ID of the B2C Commerce campaign the price adjustment was based on, or `null` if it was not
              based on a campaign.



---

### getCouponLineItem()
- getCouponLineItem(): [CouponLineItem](dw.order.CouponLineItem.md)
  - : Returns the coupon line item related to this price adjustment.
      If the price adjustment is not based on a coupon, null is returned.


    **Returns:**
    - Coupon line item or null.


---

### getCreatedBy()
- getCreatedBy(): [String](TopLevel.String.md)
  - : Returns the name of the user who created the price adjustment.
      This method returns a value if the price-adjustment was
      created as a _custom_ price-adjustment using one of the methods
      [ProductLineItem.createPriceAdjustment(String, Discount)](dw.order.ProductLineItem.md#createpriceadjustmentstring-discount),
      [ShippingLineItem.createShippingPriceAdjustment(String, Discount)](dw.order.ShippingLineItem.md#createshippingpriceadjustmentstring-discount)
      or [LineItemCtnr.createPriceAdjustment(String, Discount)](dw.order.LineItemCtnr.md#createpriceadjustmentstring-discount).
      
      
      If an agent user has created the price adjustment, the agent user's name
      is returned. Otherwise "Customer" is returned.


    **Returns:**
    - the name of the user who created the price adjustment


---

### getPromotion()
- getPromotion(): [Promotion](dw.campaign.Promotion.md)
  - : Returns the promotion associated with this price adjustment. The
      associated promotion is determined from the promotionID and campaignID
      attributes which are set by the promotions engine when applying
      discounts. Alternatively if the promotion applied as part of an AB-test,
      then the associated promotion is determined from the promotionID
      attribute and the hidden attributes, abTestID and abTestGroupID.
      
      
      If the promotion has been removed from the system since this price
      adjustment was created, or if the promotion still exists but is not
      assigned to any campaign or AB-test, this method returns null. If the
      promotion has been reassigned to a different campaign or AB-test since
      this price adjustment was created, then the system will return an
      appropriate Promotion instance. This method always returns null for
      custom price adjustments.


    **Returns:**
    - the associated promotion, or null.


---

### getPromotionID()
- getPromotionID(): [String](TopLevel.String.md)
  - : Returns the ID of the promotion related to this price adjustment.

    **Returns:**
    - ID of related promotion.


---

### getProratedPrices()
- getProratedPrices(): [Map](dw.util.Map.md)
  - : Returns a map representing the product line items to which this price
      adjustment is "related" (in the sense defined below) and the portion of
      this adjustment's price which applies to each after discount prorating is
      performed. This information is sometimes useful to display in the
      storefront but is more often useful for integrating with backend
      order-management and accounting systems which require all discounts to be
      itemized.
      
      
      The definition of "related" product line items depends on the type of
      promotion which generated this price adjustment:
      
      
      - For order promotions, price adjustments are prorated across all  product line items which are not explicitly excluded by the promotion.  Custom order price adjustments apply to all items in the LineItemCtnr.
      - For Buy-X-Get-Y product promotions, price adjustments are prorated  across all items all product line items that are involved in the  promotion, meaning that the PLI has one or more items contributing to the  qualifying product count (i.e. the item is one of the X) or receiving the  discount (i.e. the item is one of the Y).
      - Other product promotions are not prorated and simply adjust the  parent product line item, and so the returned map is of size 1.
      - For shipping promotions, this method returns an empty map.
      
      
      Buy-X-Get-Y product promotions are prorated as follows: Each price
      adjustment generated by the promotion is sequentially prorated upon the
      related items according to the items' adjusted prices after all non-BOGO
      product promotions are considered, but before order promotions are
      considered.
      
      
      Order promotions are prorated sequentially upon non-excluded items
      according to the order in which they applied during promotion processing.
      
      
      The values in the map are inclusive of tax if this price adjustment is
      based on gross pricing, and exclusive of tax otherwise. The sum of the
      prorated prices always equals the price of this price adjustment.


    **Returns:**
    - map of ProductLineItems to Money instances representing the
              product line items across which this price adjustment is prorated
              and the portion of this adjustment which applies towards each.



---

### getQuantity()
- getQuantity(): [Number](TopLevel.Number.md)
  - : Returns the number of items this price adjustment applies to. This value
      is always equal to 1 for price adjustments generated by order or shipping
      promotions. For price adjustments generated by product promotions, this
      value represents the number of units of the parent product line item to
      which the adjustment applies. Because promotions may have a maximum
      number of applications this value may be less than the product line item
      quantity.
      
      
      For custom price adjustments, not generated by the promotions engine,
      this method always returns 0.


    **Returns:**
    - The number of items this price adjustment applies to.


---

### getReasonCode()
- getReasonCode(): [EnumValue](dw.value.EnumValue.md)
  - : Returns the reason code of the price adjustment. The list of available
      reason codes is editable system meta-data. An example for using the
      reason code is that in a call center application the CSR will explain
      why he gave a discount to the customer.


    **Returns:**
    - reason code of the price adjustment


---

### isBasedOnABTest()
- isBasedOnABTest(): [Boolean](TopLevel.Boolean.md)
  - : Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a
      promotion assigned to an AB-test.


    **Returns:**
    - true if the price adjustment was generated by the B2C Commerce promotions engine when applying a
              promotion assigned to an AB-test, false otherwise.



---

### isBasedOnCampaign()
- ~~isBasedOnCampaign(): [Boolean](TopLevel.Boolean.md)~~
  - : Returns true if the price adjustment was generated by the B2C Commerce promotions engine when applying a
      promotion assigned to a Campaign or an AB-test.


    **Returns:**
    - true if the price adjustment was generated by the B2C Commerce promotions engine, false otherwise.

    **Deprecated:**
:::warning
The method has been deprecated since the name implies that there is a related Campaign, which may not
            be true. Use `!isCustom()` instead.

:::

---

### isBasedOnCoupon()
- isBasedOnCoupon(): [Boolean](TopLevel.Boolean.md)
  - : Identifies if the promotion line item results from a coupon.

    **Returns:**
    - true if the promotion line item results from a coupon, false otherwise.


---

### isCustom()
- isCustom(): [Boolean](TopLevel.Boolean.md)
  - : Returns true if this PriceAdjustment was created by custom script code.

    **Returns:**
    - true if this PriceAdjustment was created by custom script code, or false if it was created by B2C
              Commerce promotions engine.



---

### isManual()
- isManual(): [Boolean](TopLevel.Boolean.md)
  - : Returns true if this PriceAdjustment was added manually by a user.
      
      
      A manual PriceAdjustment is one which has been added as a result of
      a user interaction e.g. by a user editing an order.
      
      
      A non-manual PriceAdjustment is one which has been added for a different
      reason, e.g. by custom logic which automatically adjusts the price of
      particular products when certain conditions are met.


    **Returns:**
    - true if this PriceAdjustment was added manually by a user,
              otherwise - false



---

### setManual(Boolean)
- setManual(aFlag: [Boolean](TopLevel.Boolean.md)): void
  - : Marks the current PriceAdjustment as manual/non-manual.
      
      
      Note that only custom PriceAdjustment can be marked as manual/non-manual.
      
      
      A manual PriceAdjustment is one which has been added as a result of
      a user interaction e.g. by a user editing an order.
      
      
      A non-manual PriceAdjustment is one which has been added for a different
      reason, e.g. by custom logic which automatically adjusts the price of
      particular products when certain conditions are met.


    **Parameters:**
    - aFlag - the manual flag to set

    **Throws:**
    - IllegalArgumentException - if the adjustment is not custom


---

### setReasonCode(String)
- setReasonCode(reasonCode: [String](TopLevel.String.md)): void
  - : Set the reason code, using the internal non-localizable value. Standard values are 'PRICE\_MATCH',
      'BACKORDER' and 'EVEN\_EXCHANGE', but the available list is editable system meta-data.


    **Parameters:**
    - reasonCode - reason code


---

<!-- prettier-ignore-end -->
