ProductVariation.fromJson constructor

ProductVariation.fromJson(
  1. Map<String, dynamic> json
)

Implementation

ProductVariation.fromJson(Map<String, dynamic> json)
    : id = json['id'],
      permalink = json['permalink'],
      status = json['status'],
      description = json['description'],
      sku = json['sku'],
      price = json['price'],
      regularPrice = json['regular_price'],
      salePrice = json['sale_price'],
      onSale = json['on_sale'],
      purchasable = json['purchasable'],
      virtual = json['virtual'],
      downloadable = json['downloadable'],
      downloads = (json['downloads'] as List)
          .map((i) => Download.fromJson(i))
          .toList(),
      downloadLimit = json['download_limit'],
      downloadExpiry = json['download_expiry'],
      taxStatus = json['tax_status'],
      taxClass = json['tax_class'],
      manageStock =
          (json['manage_stock'] != null && json['manage_stock'] is bool)
              ? json['manage_stock']
              : false,
      stockQuantity = json['stock_quantity'],
      stockStatus = json['stock_status'],
      backorders = json['backorders'],
      backordersAllowed = json['backorders_allowed'],
      backOrdered = json['backordered'],
      weight = json['weight'],
      dimensions = Dimension.fromJson(json['dimensions']),
      shippingClass = json['shipping_class'],
      shippingClassId = json['shipping_class_id'],
      menuOrder = json['menu_order'],
      attributes = (json['attributes'] as List)
          .map((i) => Attribute.fromJson(i))
          .toList(),
      metaData = (json['meta_data'] as List)
          .map((i) => MetaData.fromJson(i))
          .toList(),
      image = Image.fromJson(json['image']);