GithubHelp home page GithubHelp logo

ithemes-exchange-digital-variants's Introduction

iThemes Exchange - Digital Variants

Add-on for iThemes Exchange that adds the ability to sell digital variants of physical products, including enabling downloads and removing shipping.

Motivation

While developing for an online magazine website, we wanted to offer both physical and digital versions of any given magazine in our iThemes Exchange powered online shop. Rather than making duplicate products (one Physical and one Digital) we preferred the idea of using the iThemes Exchange - Variants add-on to choose between a physical and digital version. As iThemes did not deliver this out of the box, this plugin was developed.

Description

TODO

Installation

  1. Install github-updater by downloading the latest zip. This plugin keeps iThemes Exchange - Digital Variants updated directly from the git repo.
  2. Install iThemes Exchange - Digital Variants by downloading the latest zip here. Both github-updater and iThemes Exchange - Digital Variants will now download their own updates automatically, so you will never need to go through that tedious zip downloading again.
  3. Activate the iThemes Exchange - Digital Variants plugin. It should now appear under Exchange > Add-ons

API Reference

Depending on the size of the project, if it is small and simple enough the reference docs can be added to the README. For medium size to larger projects it is important to at least provide a link to where the API reference docs live.

Tests

Describe and show how to run the tests with code examples.

Contributors

Let people know how they can dive into the project, include important links to things like issue trackers, irc, twitter accounts if applicable.

License

GPLv2 or later

ithemes-exchange-digital-variants's People

Contributors

briggysmalls avatar

Watchers

 avatar  avatar  avatar

ithemes-exchange-digital-variants's Issues

Delete any orphaned digital variants

If a setting is missing a new digital variant is created.

This means that if the digital variant id is lost somehow, or the digital variant value is lost, posts can be left orphaned.

Some attempt to cleanup should be made when creating a new variant

Plugin breaks table rate shipping

When added to a website the plugins installation seems to have caused all shipping to be applied as the default 'International' instead of correctly identifying 'UK'.

Decide on better naming

The terminology employed up until this point is completely confusing.

Currently the following concepts are in use:

  • Feature that means products can take many flavours: variant
  • A product that has a distinct flavour: variant
  • A database object that describes a set of flavours: variant
  • A product that has either physical or digital flavours: digital variant
  • A product that is of the digital flavour (out of possible physical/digital): digital variant

This really needs sorting out as the terms are so overloaded it is hard to understand what the code is trying to do.

Write tests

In just a few commits, regressions were introduced that broke the plugin. Tests should be written to avoid this

Add CI

A CI server should be set up to run the linter and execute tests

Call to undefined function

A misnamed function causes the plugin to break when attempting to checkout with a digital variant.
This should be fixed.

Make digital options configurable

With the introduction of a single variant shared by all products comes potential improvements.

A user can now rename and add/remove options to the variant and this will be reflected on all products.

However, the variants recognised as being digital are still fixed as those with a value matching the digital slug (hardcoded).

Addon settings should be introduced, allowing a user to pick which values are the digital ones.

Handle updates better

At the moment if the digital variant needs changing (due to a plugin update) then it must be deleted then re-added.

This is no good if many products already exist, as deleting the variant removes it from all of them.

Either the variant should be updated or deleted/readded to all of the existing products when the version number changes.

Note: that this should not change the variant title or value titles back to the default

Variant is not visible from frontend

The digital variants are currently not visible from the frontend. Furthermore when attempting to set a variant pricing, it is revealed that the variant values are missing from the select box.

commit: cbcaee2

Improve 'is digital variant' test for product

A product is currently identified as being the digital variant of a product, based upon whether it has a value with a slug/post_name of 'digital'.

However, should multiple format variants be created, this slug becomes digital-x where x is an integer.

The test should be improved to be more robust

Make Digital Variant custom product type

iThemes has a concept of Product Types, with the core plugin creating:

  • Simple Product
  • Physical Product
  • Digital Download

The Digital Variant product should be its own product type. This means that Physical products could be unaffected by the addition of this plugin (e.g. downloads not added to them) which may be desirable. Furthermore it simplifies the identification of products that have a variant indicating if they are Physical/Digital, as all that need be checked is the type. Perhaps a filter could be added that automates the addition of the variant too.

It seems very simple to add a product type, for example the Simple Product type is created with:

// Simple Product Types
'simple-product-type' => array(
	'name'        => __( 'Simple Products', 'it-l10n-ithemes-exchange' ),
	'description' => __( 'This is a basic product type for selling simple items.', 'it-l10n-ithemes-exchange' ),
	'author'      => 'iThemes',
	'author_url'  => 'http://ithemes.com',
	'file'        => dirname( __FILE__ ) . '/product-types/simple-products/init.php',
	'category'    => 'product-type',
	'tag'         => 'core',
	'labels'      => array(
		'singular_name' => __( 'Simple Product', 'it-l10n-ithemes-exchange' ),
	),
	'supports' => array(
		'sw-shortcode' => true
	)
),

where init.php is an empty file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.