PHPackages                             framecreative/wc-toolkit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. framecreative/wc-toolkit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

framecreative/wc-toolkit
========================

Better woocommerce endpoints

2.0.0(7y ago)11.2k1[1 PRs](https://github.com/framedigital/wc-toolkit/pulls)MITPHPPHP &gt;=5.2

Since Jul 4Pushed 7y ago4 watchersCompare

[ Source](https://github.com/framedigital/wc-toolkit)[ Packagist](https://packagist.org/packages/framecreative/wc-toolkit)[ RSS](/packages/framecreative-wc-toolkit/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (10)Used By (0)

WC Toolkit
==========

[](#wc-toolkit)

Better ajax endpoints for woocommerce

Creates the following ajax endpoints:

- add\_to\_cart
- remove\_from\_cart
- cart\_set\_quantity
- add\_coupon
- remove\_coupon
- cart\_fragments

Install
-------

[](#install)

`composer require framecreative/wc-toolkit`

Setup
-----

[](#setup)

Add `new \WC_Toolkit\WC_Toolkit();` to your function.php or anywhere in your code you initialise your theme.

Then use the filters `woocommerce_fragments_data` or `woocommerce_fragments_html` to add your custom cart fragments

Upgrading to version 2
----------------------

[](#upgrading-to-version-2)

Ajax success responses are now sent with `wp_send_json_success` instead of `wp_send_json`. So JS fragment code will need to refer to `response.data.fragments` instead of `response.fragments`.

Reset UI
--------

[](#reset-ui)

Using `new \WC_Toolkit\UI_Reset();` will dequeue all Woocommerce styles, pretty photo js/css, select2 js/css, and the default cart fragments js.

Example
-------

[](#example)

Add data to fragments

```
add_filter('woocommerce_fragments_data', function($fragments)
  {
    $fragments['span.js-cart-total'] = '' . WC()->cart->get_cart_total() . '';
    return $fragments;
  }
);
```

Create jQuery ajax call

```
var endpoint = 'add_to_cart';
var addToCartUrl = wc_add_to_cart_params.wc_ajax_url.replace('%%endpoint%%', `site_${endpoint}`));
var data = { product_id: 1, quantity: 1};

$.ajax({
  url: addToCartUrl,
  data: data,
  method: 'POST'
})

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~51 days

Recently: every ~92 days

Total

9

Last Release

2874d ago

Major Versions

1.4.3 → 2.0.02018-08-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/0aa72f116f5374b54c5f58eb5dfa808a5d7c76114a6db4e4b1507641f57ed1f0?d=identicon)[framecreative](/maintainers/framecreative)

---

Top Contributors

[![jackmcpickle](https://avatars.githubusercontent.com/u/89775?v=4)](https://github.com/jackmcpickle "jackmcpickle (16 commits)")

---

Tags

ajax-endpointscart-fragmentswoocommercewordpress-php-library

### Embed Badge

![Health badge](/badges/framecreative-wc-toolkit/health.svg)

```
[![Health](https://phpackages.com/badges/framecreative-wc-toolkit/health.svg)](https://phpackages.com/packages/framecreative-wc-toolkit)
```

###  Alternatives

[freshbitsweb/laratables

Ajax support of DataTables for Laravel

4851.1M3](/packages/freshbitsweb-laratables)[web3p/ethereum-util

A collection of utility functions for Ethereum written in PHP.

29451.6k26](/packages/web3p-ethereum-util)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
