Skip to content

Commit

Permalink
Update cp-donations to version 2
Browse files Browse the repository at this point in the history
Includes custom donations
  • Loading branch information
timbocode committed Feb 18, 2021
1 parent 66b6ad8 commit 8d58568
Show file tree
Hide file tree
Showing 30 changed files with 3,961 additions and 905 deletions.
23 changes: 23 additions & 0 deletions wp-content/plugins/cp-donations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ignore everything in the root except the "wp-content" directory.
!wp-content/

# ignore everything in the "wp-content" directory, except:
# "mu-plugins", "plugins", "themes" directory
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/

# ignore these plugins
wp-content/plugins/hello.php

# ignore specific themes
wp-content/themes/twenty*/

# ignore node dependency directories
node_modules/

# ignore log files and databases
*.log
*.sql
*.sqlite
13 changes: 13 additions & 0 deletions wp-content/plugins/cp-donations/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#### v 2.0.0 / 2021-02-17
* Addition of custom amount feature to allow donations of any amount.
* Shortcode now accepts product ID as parameter.
* Includes Update Manager so that the plugin can be updated from admin.
* Wording on buttons improved.

#### v 1.1.0 / 2020-10-04
* Improved checkout process. "Add to cart" now goes straight to checkout.
* "Add to cart" button text changed to "Donate Now"
* Added "Clear Cart" button

#### v 1.0.0 / 2020-09-10
* Initial release
339 changes: 339 additions & 0 deletions wp-content/plugins/cp-donations/LICENSE

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions wp-content/plugins/cp-donations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Donations for ClassicPress

Donations for ClassicPress is a small plugin that works with [Classic Commerce](https://github.com/ClassicPress-plugins/classic-commerce) to display the donation options in an easy-to-use format on the frontend.

Instead of showing the donation options as a dropdown, this plugin converts them to radio buttons. It also provides website visitors with the option of donating a custom amount.

* * *

## Installation

1. Head over to the [Releases section](https://github.com/timbocode/cp-donations/releases) of this GitHub repository.
2. Expand the "Assets" dropdown by the latest release and download the `cp-donations.zip` file.
3. Go to the "Plugins > Add New" section of your site's dashboard and upload the zip file there using the "Upload Plugin" button.

## Minimum Requirements

- ClassicPress 1.0.2
- PHP 7.0

## Settings

This plugin adds a CP Donations tab in Classic Commerce settings:

**Checkout message (US Only)** - Checkout message shown to visitors from the United States only. This is intended to be a note about donations being tax-deductible.

**Minimum Amount text** - the text to display before the minimum accepted amount.

**Custom Amount text** - the text that appears above the CP Donations input field.

**Add to Cart button text** - the text that appears on the Add to Cart button. Leave blank to inherit the default add to cart text.

**Place Order button text** - the text that appears on the Place Order button on the checkout page. Leave blank to inherit the default text.

## Setting up a donation product

1. Create a variable product.
2. Add product to the Donations category.
3. Set up attributes for the donation amounts. For example:

`Recurring: $5/month | Recurring: $15/month | Recurring: $30/month | Recurring: $60/month | Recurring: $90/month | Recurring: $custom/month | One-time: $5 | One-time: $15 | One-time: $30 | One-time: $60 | One-time: $90 | One-time: $custom`

4. Select the "`Used for variations option`".
5. On the variations tab, select "`Create variations from all attributes`" from the dropdown.
6. Set the SKU to something beginning with '`recurring_`' or '`once_`', depending on whether this is a recurring or one-off variation.
7. For variations with a custom amount, select the "`Custom amount`" checkbox. This then replaces the "`Regular price`" and "`Sale price`" input boxes with a single "`Minimum amount`" box.

The minimum amount can be used to prevent customers making a donation of a value that is less than it costs to process the donation.

## Displaying the donation product on the frontend

This is done by simply adding the following shortcode in a page or post:

```
[cp_donation product_id="xxxx"]
```

where "xxxx" is the ID of the variation product just created.
243 changes: 243 additions & 0 deletions wp-content/plugins/cp-donations/assets/css/cpd-custom-amount.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
.woocommerce .cpd-product-single div.product {
width: 100%;
clear: both;
display: flex;
}

.woocommerce .cpd-product-single div.product div.summary {
float: right;
width: 100%;
clear: none;
}

.cpd-active .variations_form .variations, .cpd-variations + .variations {
display: none;
}

.cpd-active.cpd-show-price .variations_form .single_variation .woocommerce-variation-price {
display: none !important;
}

.cpd-active.cpd-show-description .variations_form .single_variation .woocommerce-variation-description {
display: none !important;
}

.cpd-active.cpd-show-availability .variations_form .single_variation .woocommerce-variation-availability {
display: none !important;
}

.cpd-variations {
padding: 15px;
background: #f6f6f6;
border: 1px solid #ddd;
margin-bottom: 20px;
display: table;
width: 100%;
}

.cpd-variations .cpd-variation {
display: flex;
align-items: center;
cursor: pointer;
}

.cpd-variations .cpd-variation:hover {
background-color: #ffffff;
}

.cpd-variations .cpd-variation > div {
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
}

.cpd-variations .cpd-variation > div:last-child {
padding-right: 0;
}

.cpd-variation-selector input {
outline: none;
}

.cpd-variation-selector ul {
padding: 0 !important;
margin: 0 !important;
list-style: none !important;
}

.cpd-variation-info, .cpd-variation-selector {
flex-grow: 1;
}

.cpd-variation-name p {
margin-bottom: 0;
font-size: 12px;
}

.cpd-variation-radio .cpd-variation-selector, .cpd-variation-radio-custom .cpd-variation-selector {
width: 30px;
flex: 0 0 30px;
}

.cpd-variation-radio .cpd-variation-availability p, .cpd-variation-radio-custom .cpd-variation-availability p {
margin-bottom: 0;
}

.cpd-variation-radio .cpd-variation-name, .cpd-variation-radio-custom .cpd-variation-name, .cpd-variation-radio-custom .cpd-custom-amount-min {
font-weight: 400;
font-size: 16px;
}

.cpd-variation-radio .cpd-variation-info .cpd-variation-price,
.cpd-variation-radio-custom .cpd-variation-info .cpd-variation-price,
.cpd-variation-radio .cpd-variation-info .cpd-variation-availability {
display: inline-block;
margin-right: 10px;
font-size: 14px;
}

.cpd-variation-radio .cpd-variation-info .cpd-variation-description, .cpd-variation-radio-custom .cpd-variation-info .cpd-variation-description {
font-size: 14px;
}

.cpd-col {
display: table-cell;
width: 49%;
}

.cpd-col.cpd-col-1 {
padding-right: 1%;
}

.cpd-col.cpd-col-2 {
padding-left: 1%;
}

.woocommerce .donations button.button {
padding: 20px 8px;
}

.woocommerce .cpd-product-single div.product div.summary form.cart .button,
.woocommerce div.product div.summary.donations form.cart .button {
vertical-align: middle;
float: right;
min-width: 280px;
font-size: 1.3em;
padding: .8em;
border: 2px solid #338084;
}

.woocommerce .donations button.button.alt {
background-color: #338084;
border: 2px solid #338084;
color: #fff;
}

.woocommerce .cpd-product-single div.product div.summary form.cart .button:hover,
.woocommerce .donations .woocommerce-variation-add-to-cart-enabled button.button.alt:hover {
background-color: #fff;
color: #338084;
border: 2px solid #338084;
}

.woocommerce div.product div.summary.donations {
float: none;
width: 100%;
clear: both;
}

.woocommerce div.product div.summary.donations form.cart .woocommerce-variation-add-to-cart {
width: auto;
display: table-cell;
float: right;
}

.woocommerce div.product div.summary.donations form.cart .button {
vertical-align: middle;
float: right;
}

.woocommerce div.product div.summary.donations .woocommerce-variation.single_variation {
width: auto;
display: table-cell!important;
float: left;
}

.woocommerce div.product p.price, .woocommerce div.product span.price {
color: #843358;
font-size: 1.3em;
font-weight: 600;
}

.product .cpd-disabled {
opacity: .2;
}

.product .single_variation_wrap {
padding: 15px;
background: #f6f6f6;
border: 1px solid #ddd;
margin-bottom: 20px;
display: table;
width: 100%;
min-height: 94px;
}

.product .single_variation_wrap .cpd {
display: none;
width: auto;
float: left;
clear: none;
margin-bottom: 0;
}

.product .cpd {
margin-bottom: 1.5em;
}

.product .cpd label {
font-weight: 700;
display: block;
}

.product .cpd .cpd-input {
display: inline-block;
margin-bottom: 0;
text-align: left;
font-weight: 400;
min-width: 7em;
}

.product .cpd .minimum-price {
margin: 0;
color: inherit;
font-size: .75em;
opacity: .7;
}

.product .cpd .woocommerce-cpd-message {
margin: 1em 0!important;
}

.product .cpd:after {
content: "";
display: table;
clear: both;
}


/* Stripe stuff */
body.cpd_checkout.woocommerce-checkout #payment ul.payment_methods li img.stripe-icon {
max-width: 40px;
height: auto;
padding: 0 0 0 3px;
margin: 0;
vertical-align: middle;
position: relative;
}

@media (max-width:768px) {
.cpd-variations .cpd-variation {
padding-left: 0;
}
}
Loading

0 comments on commit 8d58568

Please sign in to comment.