WishListItem

@objc(GFYWishListItem)
public class WishListItem : NSObject, Encodable

Represents a product within a wish list

  • The parent ID of the product

    Declaration

    Swift

    @objc
    public let productId: String
  • Whether the item is currently in stock

    Declaration

    Swift

    @objc
    public let inStock: Bool
  • sku

    The specific SKU of the product/variant (optional)

    Declaration

    Swift

    @objc
    public let sku: String?
  • The current unit price of the product, after discount or sale pricing (optional)

    Declaration

    Swift

    @objc
    public let price: Price?
  • The regular price of the product before sales or discounts (optional)

    Declaration

    Swift

    @objc
    public let regularPrice: Price?
  • The name or title of the product (optional)

    Declaration

    Swift

    @objc
    public let title: String?
  • The address of the product image (optional)

    Declaration

    Swift

    @objc
    public let image: URL?
  • The date when the product was added to the list (optional)

    Declaration

    Swift

    @objc
    public let dateAdded: Date?
  • The price of the product when it was added to the list (optional)

    Declaration

    Swift

    @objc
    public let priceWhenAdded: Price?
  • Address of the product’s anchor tag in the list page (optional)

    e.g. “https://domain.com/wishlist#1234

    Declaration

    Swift

    @objc
    public let callToAction: URL?
  • Address of the product page (optional)

    Declaration

    Swift

    @objc
    public let productPage: URL?
  • Creates a WishListItem instance from each distinct item property

    Declaration

    Swift

    @objc
    public init(productId: String,
                inStock: Bool,
                sku: String? = nil,
                price: Price? = nil,
                regularPrice: Price? = nil,
                title: String? = nil,
                image: URL? = nil,
                dateAdded: Date? = nil,
                priceWhenAdded: Price? = nil,
                callToAction: URL? = nil,
                productPage: URL? = nil)

    Parameters

    productId

    The parent ID of the product

    inStock

    Whether the item is currently in stock

    sku

    The specific SKU of the product/variant (optional)

    price

    The current unit price of the product, after discount or sale pricing (optional)

    regularPrice

    The regular price of the product before sales or discounts (optional)

    title

    The name or title of the product (optional)

    image

    The address of the product image (optional)

    dateAdded

    The date when the product was added to the list (optional)

    priceWhenAdded

    The price of the product when it was added to the list (optional)

    callToAction

    Address of the product’s anchor tag in the list page (optional)

    productPage

    Address of the product page (optional)

  • Creates a WishListItem instance from a Product and any additional (optional) property values.

    Precondition

    The inStock property of the provided Product instance must be non-nil. nil will be returned if this condition is not met.

    Declaration

    Swift

    @objc
    public convenience init?(product: Product,
                             dateAdded: Date? = nil,
                             priceWhenAdded: Price? = nil,
                             callToAction: URL? = nil,
                             productPage: URL? = nil)

    Parameters

    product

    The product in the wish list

    dateAdded

    The date when the product was added to the list (optional)

    priceWhenAdded

    The price of the product when it was added to the list (optional)

    callToAction

    Address of the product’s anchor tag in the list page (optional)

    productPage

    Address of the product page (optional)

  • Encodes an instance of WishListItem

    Since

    2.0.0

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws