Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polishing Product types and connections #22

Merged
merged 3 commits into from
Apr 9, 2019
Merged

Conversation

kidunot89
Copy link
Member

@kidunot89 kidunot89 commented Apr 8, 2019

Your checklist for this pull request

Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.

🚨Please review the guidelines for contributing to this repository.

  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Make sure you are requesting to pull request from a topic/feature/bugfix branch (right side). Don't pull request from your master!

What does this implement/fix? Explain your changes.

  • Removes old files
  • Convert all ProductDownload from Product_Downloads to 'list_of => 'ProductDownload'
  • Add Product connections where arguments
    • post status
    • taxonomies
      • product category
      • product tag
      • product shipping class
      • product type
      • attribute and attribute term
    • featured products
    • sku
    • tax class
    • price
    • on sale
    • stock status
{
  products(where: {
    slug: STRING
    status: STRING
    type: STRING
    typeIn: STRING[]
    typeNotIn: STRING[]
    sku: STRING
    featured: BOOLEAN
    categoryName: STRING
    categoryNameIn: STRING[]
    categoryNameNotIn: STRING[]
    category: INT
    categoryIn: INT[]
    categoryNotIn: INT[]
    tag: STRING
    tagSlugIn STRING[]
    tagSlugNotIn: STRING[]
    tagId: INT
    tagIn: INT[]
    tagNotIn: INT[]
    attribute: STRING
    attributeTerm: STRING
    inStock: BOOLEAN
    onSale: BOOLEAN
    minPrice: FLOAT
    maxPrice: FLOAT
    search: STRING
  }) {
    ...
  }
}
  • Add last 10 fields to Product type to match WC REST API functionality
    • onSale
    • purchasable
    • externalUrl
    • buttonText
    • backordersAllowed
    • related
    • shippingRequired
    • shippingTaxable
    • shippingClass
    • groupedProduct

Query equivalent to WC REST's All products query

{
  products {
    nodes {
      id
      productId
      name
      slug
      date
      modified
      type
      status
      featured
      catalogVisibility
      description
      shortDescription
      sku
      price
      regularPrice
      salePrice
      dateOnSaleFrom
      dateOnSaleTo
      virtual
      downloadable
      downloads {
        allowedFileType
        name
        file
      }
      downloadLimit
      downloadExpiry
      taxStatus
      taxClass
      manageStock
      stockQuantity
      stockStatus
      backorders
      soldIndividually
      weight
      length
      width
      height
      onSale
      purchasable
      externalUrl
      buttonText
      backordersAllowed
      shippingRequired
      shippingTaxable
      shippingClassId
      ratingCount {
        average
        oneStars
        twoStars
        threeStars
        fourStars
        fiveStars
        average
      }
      upsell {
        nodes {
          productId
        }
      }
      crossSell {
        nodes {
          productId
        }
      }
      parent {
        productId
      }
      purchaseNote
      categories {
        nodes {
          id
          name
          slug
        }
      }
      tags {
        nodes {
          id
          name
          slug
        }
      }
      galleryImages {
        nodes {
          id
          sourceUrl
          title
          altText
          date
          modified
        }
      }
      attributes {
        nodes {
          attributeId
          name
          position
          visible
          variation
          options
        }
      }
      defaultAttributes {
        nodes {
          attributeId
          name
          position
          visible
          variation
          options
        }
      }
      related {
        nodes {
          id
          productId
        }
      }
      variations {
        nodes {
          id
          variationId
        }
      }
      grouped {
        nodes {
          id
          productId
        }
      }
      menuOrder
    }
  }
}

Does this close any currently open issues?

Any relevant logs, error output, GraphiQL screenshots, etc?

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?

Where has this been tested?

Operating System:

WordPress Version:

@kidunot89 kidunot89 added bug Something isn't working enhancement New feature or request work in progress Solution development in progress labels Apr 8, 2019
@kidunot89 kidunot89 self-assigned this Apr 8, 2019
@kidunot89 kidunot89 changed the title Product type polish Polishing Product types and connections Apr 8, 2019
@kidunot89 kidunot89 merged commit 25ea51d into develop Apr 9, 2019
@kidunot89 kidunot89 removed the work in progress Solution development in progress label Apr 10, 2019
@renatonascalves renatonascalves deleted the bug/product-downloads branch May 4, 2019 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant