Woo Solo Api

Description

Woo Solo Api plugin will integrate with your checkout process, and will send the API request with
the order details to the SOLO service which will in turn create a PDF of the invoice or order on your SOLO dashboard.

Additionally, the invoice or order will be stored on your site, and you’ll have the option of sending this PDF as a separate
mail to the client.

There is an entire options page where you can specify the details of the order or the invoice such as unit measure, payment
options, language of the invoice, currency and others.

The plugin is translated to Croatian, since the SOLO service is primarily used by Croatian users.

For more information about the SOLO API visit this link: https://solo.com.hr/api-dokumentacija

Requirements

  • PHP 7.3 or greater
  • WordPress 5.3 or above
  • WooCommerce 4.0.0 or above
  • Non IE browser

Screenshots

  • After installation, you can go to the plugin settings and add your SOLO token
  • You can set up various options that are directly linked to how you want the invoice to look like
  • You can add some additional WooCommerce settings such as PIN and IBAN fields
  • You can add the mail settings that will be send (if you choose to) to the client when the order is completed
  • You can test if your API key works properly and that communication with the Solo API works
  • You can check the sent orders, whether the order was sent to API, and if the customer got the PDF or not (or if error happened on the API)

Installation

Installing the plugin is easy. Just follow these steps:

Installing from WordPress repository:

Be sure you have WooCommerce plugin installed first, otherwise you’ll get an error on the plugin activation.

  1. From the dashboard of your site, navigate to Plugins –> Add New.
  2. In the Search type Woo Solo Api
  3. Click Install Now
  4. When it’s finished, activate the plugin via the prompt. A message will show confirming activation was successful.

Uploading the .zip file:

  1. From the dashboard of your site, navigate to Plugins –> Add New.
  2. Select the Upload option and hit “Choose File.”
  3. When the popup appears select the woo-solo-api.x.x.zip file from your desktop. (The ‘x.x’ will change depending on the current version number).
  4. Follow the on-screen instructions and wait as the upload completes.
  5. When it’s finished, activate the plugin via the prompt. A message will show confirming activation was successful.

FAQ

Why is the PHP 7.3 required?

Because the reality is that PHP 8 right outside the door. And if you have older PHP versions, you are not only doing a disservice to the planet, you’re also harming your own site speed and security. You can always ask your hosting provider to fix this for you, or if you have control over cPanel on shared hosting, you are likely to be able to update PHP version yourself. Just make sure you tick all the required PHP extensions (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions).

I didn’t receive an invoice when testing the plugin. What’s wrong?

Give it a minute, scroll your site. The API communication happens using WP cron, which depends on the site activity to work. You can always check the ‘Solo API order details’ tab in the settings to see if there was some error from the API.
If that fails, turn on the debug mode (https://wordpress.org/support/article/debugging-in-wordpress/) and try to test again. If there was a fatal error it should be shown in the logs.

This plugin doesn’t work with XYZ plugin

Could be. I didn’t test it out with every plugin in the wild. That takes time. And money. And so far, nobody paid me to work on this plugin. In the near future I might be able to do some paid work, but that will depend on many different things.
Please don’t try to guilt trip me to work on your site specific issues. I will try to help to the best of my abilities. But the plugin is free, and I am not doing paid support, so don’t expect me to work miracles. Also, don’t expect me to drop everything just to work on your issue. If I don’t answer in a day or two, be patient. I have a private life as well (shocker, I know) 😀

Can I modify how the email looks, or customer notice?

Sure you can, besides actually adding things in the settings of the plugin you can modify certain things using these hooks:

Overwrite the checkout request for specific payment cases

This filter is used if you have globally selected the API request to happen on
manual status change of the order, but you want to allow some payment gateways to
execute on the checkout.

Usage:

add_filter('woo_solo_api_overwrite_request_on_checkout', 'my_payment_processor_overwrite', 10, 2);

function my_payment_processor_overwrite($sendControl, $order) {
  // Say we want to allow api call on checkout for direct bank transfer (bacs),
  // and all others on status change.

  // Check the payment gateway from the order.
  $paymentMethod = $order->get_payment_method();

  // Check if the current payment method is the one you want to overwrite.
  if ($paymentMethod === 'bacs') {
    return 'checkout';
  }

  // Default fallback.
  return $sendControl;
}



@param string $sendControl Type of send control. Can be 'checkout' or 'status_change'.
@param WC_Order $order Order object.

Filters the custom message for customer note

If you need to extend the customer note, you can just hook to this filter
and modify the existing content

Usage:

add_filter('woo_solo_api_modify_customer_note', 'my_customer_filter', 10, 2);

function my_customer_filter($customerNote, $order) {
  // (maybe) modify $customerNote.
  return $customerNote;
}



@param string $customerNote Existing customer note.
@param WC_Order $order Order object

Filters the Solo API request body before it’s being prepared for sending

If you need to modify the request towards the SOLO API,
you can just hook to this filter and modify the request body.

Usage:

add_filter('woo_solo_api_modify_request_body', 'my_customer_filter', 10, 2);

function my_customer_filter($requestBody, $order) {
  // (maybe) modify $requestBody.
  return $requestBody;
}



@param array $requestBody Existing customer note.

Modify the email message from the options

Email message can be set in the options and will be outputted here.
If, for whatever reason we want to modify it some more, we can do that here.

Usage:

add_filter('woo_solo_api_modify_options_email_message', 'my_message_filter', 10, 3);

function my_message_filter($emailMessage, $orderId, $email) {
  // (maybe) modify $emailMessage.
  return $emailMessage;
}



@param string $emailMessage Email message from options to filter.
@param int    $orderId Order ID.
@param string $email Email address of the person for whom this message needs to be send to.

Modify the default email message

If you don’t set the message in the options, you can still filter the default one.

Usage:

add_filter('woo_solo_api_modify_default_email_message', 'my_message_filter', 10, 3);

function my_message_filter($defaultMessage, $orderId, $email) {
  // (maybe) modify $defaultMessage.
  return $defaultMessage;
}



@param string $defaultMessage Email message to filter.
@param int    $orderId Order ID.
@param string $email Email address of the person for whom this message needs to be send to.

Modify the email title from the options

Email title for the customer can be set in the options,
but you can modify it further with this filter.

Usage:

add_filter('woo_solo_api_modify_options_email_title', 'my_title_filter', 10, 2);

function my_title_filter($emailTitle, $orderId) {
  // (maybe) modify $emailTitle.
  return $emailTitle;
}



@param string $emailTitle Email title.
@param int    $orderId Order ID.

Modify the default email title from the options

If you don’t use the title from the options, you can use default one.
And modify it.

Usage:

add_filter('woo_solo_api_modify_default_email_title', 'my_title_filter', 10, 2);

function my_title_filter($defaultTitle, $orderId) {
  // (maybe) modify $defaultTitle.
  return $defaultTitle;
}



@param string $emailTitle Email title.
@param int    $orderId Order ID.

Filter email headers

When email to customer is sent, maybe you want to add something more. In that
case you’ll probably need to modify the headers sent with the email.
Default ones are

[
    'MIME-Version: 1.0',
    'Content-Type: text/html',
];

You can add to that list.

Usage:

add_filter('woo_solo_api_email_headers', 'my_custom_email_headers', 10);

function my_custom_email_headers($headers) {
  // (maybe) modify $headers.
  return $headers;
}



@param array $headers Email headers to pass to wp_mail.

Filter the ‘from’ name set from the options

Usage:

add_filter('woo_solo_api_change_email_from_name', 'my_custom_from_name', 10);

function my_custom_from_name($name) {
  // (maybe) modify $name.
  return $name;
}



@param string $name Name to change in the "From" field.

Adds a global discount

WooCommerce will handle counting the discounts for us.
This is why this is set to 0.
We can hook into this if we want to change it.
But this hook will affect every item. So use it with care.

Usage:

add_filter('woo_solo_api_add_global_discount', 'my_global_discount', 10, 1);

function my_global_discount($globalDiscount) {
  // (maybe) modify $globalDiscount.
  return $globalDiscount;
}



@param int $globalDiscount The value of the global discount to apply to every item.

Modify tax rates

This hook is used to set different tax rates for items based on certain criteria.
For instance, if you want to modify taxes based on location you can change it here
(if for some reason it’s not working from the default settings).

Usage:

add_filter('woo_solo_api_modify_tax_rate', 'my_tax_rate', 10, 3);

function my_tax_rate($taxRate, $itemData, $taxRates) {
  // (maybe) modify $taxRate.
  return $taxRate;
}



@param float $taxRate  The value of the tax rate for the current order item.
@param array $itemData The data for the current order item.
@param array $taxRates The value of the tax rates for the current order item.

Reviews

May 18, 2021
It works, some advanced features missing, for example "manually send the order to Solo" in case it is not sent automatically. Maybe make a more advanced PRO version (paid version)? Thanks
March 6, 2021
Installation is simple and straightforward, users of SOLO service could setup functional integration with WooCommerce shop in few minutes to transfer offers and invoices to SOLO account. Great job!
July 1, 2018
Great plugin for Solo. Works great, offer is automatically sent to buyer when the order is set, and same offer is displayed in Solo. Technical support from developer is really great!
February 14, 2018
Integrates well with the service and helps you do everything from your website. Definite must if you use WooCommerce and Solo 🙂
Read all 4 reviews

Contributors & Developers

“Woo Solo Api” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Woo Solo Api” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

2.2.0

Release Date: January 18th, 2022

Added:

  • Added new filters (See FAQ section for more info)

Fixed:

  • Fix the localization notice
  • Fix PHPStan errors

2.1.0

Release Date: March 7th, 2021

Added:

  • Added new filters and arguments to existing filters (See FAQ section for more info)
  • Added a check if WooCommerce plugin is active to prevent fatal errors if you disable WooCommerce before this plugin

Fixed:

  • Change name of the language translation files so that they work properly
    • In case the translation doesn’t work automatically, place the woo-solo-api-hr.mo in the
      /wp-content/languages/plugins folder

2.0.8

Release Date: December 29th, 2020

Changed:

  • Updated JS packages and webpack bundling process (updated to webpack 5)

Fixed:

  • Update bundle of the assets and the PHP packages (possible cause to some issues in version 2.0.7?)

2.0.7

Release Date: December 28th, 2020

Fixed:

  • Changed the typehint of the admin order fields hook.

2.0.6

Release Date: November 30th, 2020

Fixed:

  • Add assets to the plugin. The GH Action tag is not working as intended so this is a manual fix.

2.0.5

Release Date: November 29th, 2020

Fixed:

  • Fix the company name showing on the order and sending taxes option towards API.

2.0.4

Release Date: November 28th, 2020

Added:

  • Clear error log message if order is manually triggered and succeeds.

Changed:

  • Priority changed on the on completed WooCommerce hook.

Fixed:

  • Remove shipping from all the variables, fix shipping tax calculation
    *The shipping does not concern us really, so no need to pull any fields from there.

    • Shipping was a bit changed, so it didn’t pick anything up and reported 0 tax on taxable shipping.
  • Fix the defaults in the settings (languages, checkout settings) in PHP.

2.0.3

Release Date: November 25th, 2020

Fixed:

  • Add a default fallback on save in case a settings is undefined or null in settings

2.0.2

Release Date: November 24th, 2020

Fixed:

  • Add a check if the options to be serialized exist at all before attempting to deserialize them

2.0.1

Release Date: November 23rd, 2020

Fixed:

  • Autoload order in main plugin file, so that the first error can be thrown correctly, if it happens
  • Fix the uninstall error because of a missing autoloader file
  • Add fallbacks in case there is no gateway set, so that the JS doesn’t fail when deserializing arrays

2.0.0

Release Date: November 22nd, 2020

This is a very big update. I called this the refactor, because the basic functionality of the plugin remained the same. But in all reality, this was a total plugin rewrite. You’ll need to make sure you have PHP 7.3 installed on your server.

The options remained the same, so none of the settings on an already existing version should disappear. Plugin will
need to be disabled and then enabled again once updated, so that the database table can be created.

There is one bug that is coming from the fact that the new settings page is built using Gutenberg blocks. Due to a
nature of translations and how they work in GB, and the fact that I’m relying on webpack to bundle my assets. The
translations are not working properly. There is an issue opened in WP-CLI (make-json does not work for .jsx files
), but so far we don’t have a fix for this. Once the fix comes
out I’ll update the plugin’s translation files. The plugin’s .po file is fully translated to Croatian, but we need a json file as well for the JavaScript translations.

The options page has been revamped and is built using Gutenberg components. So that’s nice.

Api calls towards Solo service are now run as a background process. So don’t be alarmed if the order doesn’t appear
immediately, or if the Solo invoice/order doesn’t come immediately to the customer. Give it some time, and rummage
around a bit, to trigger WordPress cron 😀

A lot of issues were fixed. The plugin should be more stable and work better now.

Added:

  • Tests – several acceptance tests and integration tests using wp-browser
  • Added several rest routes for internal use
    • Account Details – fetches orders from SOLO API (for testing if api calls work)
    • Order Details and its collection – details about orders fetched from the database
  • Added new database for sending orders to API
    • We need to keep track if the order was sent or not, and it’s better to have a table with this information in it. We can update it when the API request is made, and when the process for triggering user email happens. This gives us more control later on if we need to debug something (missing emails, missing requests, etc.).
  • Add privacy related functionality
    • This functionality hooks into WP’s own core privacy functionality. So that if the user requests their data to be
      either exported or deleted we remove the data in the custom table we created.
  • Added filters for modifying certain data in the plugin
  • Link the invoice from the Solo service with the WooCommerce invoice

Changed:

  • Refactored the entire plugin structure to use dependency injection, autowiring, PSR-4 autoloading and PSR-12 coding
    standards
  • Replaced old settings page with new, core editor powered settings page
  • Settings page now includes WooCommerce navbar
  • Sending any remote call towards Solo API is now done utilizing WordPress cron.
    • It’s not ideal, as WordPress cron is
      not a real cron, but it seems to be working. With queueing calls we are less likely to trigger API throttling from
      the Solo Api. Oftentimes there would be no orders created in the Solo service, and the user would be none the wiser
      what happened. By queueing we avoid this throttling. Also, we have a better way of logging errors from the API.

Removed:

  • Removed the filter for PDF file types as those are no longer saved in the media uploads folder

Fixed:

  • If 2 transactions are marked as complete, only one will send the call to solo API for completion
    • Fixed by adding a db with checks from the database
  • When changing the order from on hold to completed in the order screen the API call is made again
    • Fixed by adding a db with checks from the database
  • Make company field mandatory if R1 type of invoice is selected
  • Check if the offer/bill is created twice
    • Fixed by adding a db with checks from the database
  • Plugin recognizes Braintree and Corvus payment gateways

1.9.6

Release Date: May 18th, 2019

Changed:

  • Tested with WordPress 5.2
  • Tested with WooCommerce 3.6.3

1.9.5

Release Date: December 9th, 2018

Added:

  • Added escaping to activation messages

Changed:

  • Updated composer.json (development only)
  • Updated phpcs.xml.dist (development only)
  • Tested with WordPress 5.0

Fixed:

  • Fixed issue with multiple requests being made towards the SOLO service
  • Fixed the issue with no emails being send on order status change
  • Fixed the wrong plugin settings link on the plugins admin page
  • Fixed .travis build (development only)
  • Minor autoload fixes (removed manual requirement for activation hook)

1.9.4

Release Date: December 3rd, 2018

Added:

  • Added removal of all offers

Changed:

  • Changed the name of the offers and invoices

Fixed:

  • Fixed important GDPR issue – no longer saving offers and invoices because they contain sensitive information, and
    google will crawl your site and make them public

1.9.3

Release Date: August 26th, 2018

Added:

  • Manually add translations for the recalculated note, since locale manipulation was causing site language change

Fixed:

  • Fix the status check for the currency list

1.9.2

Release Date: July 11th, 2018

Fixed:

  • Minor fix – put WC() in the global scope

1.9.1

Release Date: June 30th, 2018

Fixed:

  • Minor fix in the Admin class constructor (string typehinting is not available prior to PHP 7)

1.9.0

Release Date: June 6th, 2018

Added:

  • Added the ability to translate the invoice/offer based on the selected and available language

Changed:

  • Moved the Solo API options under the WooCommerce menu
  • Extended the due date time to include 1-6 days in addition to 1-3 weeks

1.8.1

Release Date: June 6th, 2018

Added:

  • Add a check if no shipping is selected in the WooCommerce options

Changed:

  • Minor code refactor (constants instead of properties in the main class)
  • Replaced built in autoloader for composers autoloader

1.8.0

Release Date: May 7th, 2018

Added:

  • Add test method that returns all receipts from Solo API to check if the plugin is working properly.

Changed:

  • Minor visual adjustments

1.7.5

Release Date: April 29th, 2018

Added:

  • Add fallback method for fetching currency rates in case the `allow_url_fopen is disabled.

1.7

Release Date: March 24th, 2018

Added:

  • Added payment types for each payment gateway

Fixed:

  • Tax fixes – tax class wasn’t working on changing the order to status ‘complete’
  • Added travis integration (development)
  • Added code standards definition (development)

1.6

Release Date: March 3rd, 2018

Fixed:

  • Fixed language issue on the invoices (props to ivoks)
  • PHPCS fixes

1.5

Release Date: March 1st, 2018

Changed:

  • Set the transient validity to 6 hours so every 6 hours it will expire and be created again

Fixed:

  • Fixed the currency rate to pull it from the official hnb site

1.4

Release Date: February 25th, 2018

Added:

  • Added automatic conversion rate from Croatian National Bank (https://www.hnb.hr/temeljne-funkcije/monetarna-politika/tecajna-lista/tecajna-lista)
  • Add a fix for duplicated orders – you can now choose if you want to make SOLO API call on the checkout or when
    changing order status manually

Fixed:

  • Fix for taxes rounding error on shipping

1.3

Release Date: February 25th, 2018

Added:

  • Add additional debug methods
  • Add tax check – tax rate can be separate for shipping and for items, and are handled by WooCommerce

Fixed:

  • Code sniffer fixes

1.2

Release Date: December 10th, 2017

Changed:

  • Renamed classes – shorten the name of the classes and changed file names

Fixed:

  • Fixed a bug that prevented sending of the pdf bill if the type of the bill was offer (ponuda)

1.1

Release Date: November 23rd, 2017

Added:

  • Added multiple invoice type selection based on payment type with appropriate fiscalization check

Changed:

  • Fiscalization will be disabled for offer by default, and enabled only on invoice type

1.0.1

Release Date: November 22nd, 2017

Fixed:

  • Typo fix

1.0

Release Date: November 22nd, 2017

  • Initial release