Andrew Reva
Forum Replies Created
-
Hello there
I think you may use the following code as a reference and adapt it to your requirements in order to create the invoices programmatically.
function sliced_create_invoice_programmatically_example() { /** * 1) Invoices are stored as Custom Post Type 'sliced_invoice'. * Let's start by creating a new post: */ $args = array( 'post_title' => 'Example Invoice Title', 'post_content' => 'Description here', 'post_author' => get_current_user_id(), 'post_status' => 'publish', 'post_type' => 'sliced_invoice', ); $invoice_id = wp_insert_post( $args ); /** * 2) now let's attach some extra pieces of information. * These are stored as post metas: */ // MOST IMPORTANT, the user ID of the client the invoice is associated with: update_post_meta( $invoice_id, '_sliced_client', 1 ); // example: user ID "1" // invoice created date: update_post_meta( $invoice_id, '_sliced_invoice_created', time() ); // example: now // invoice due date: update_post_meta( $invoice_id, '_sliced_invoice_due', date( "U", strtotime( "2018-12-31" ) ) ); // example: Dec. 31, 2018 // invoice number: update_post_meta( $invoice_id, '_sliced_invoice_number', sliced_get_next_invoice_number() ); Sliced_Invoice::update_invoice_number( $invoice_id ); // advance invoice number for the next time // automatically enable your chosen payment methods: $payment_methods = sliced_get_accepted_payment_methods(); update_post_meta( $invoice_id, '_sliced_payment_methods', array_keys($payment_methods) ); // let's put in some line items: $line_items = array( array( 'qty' => '1', 'title' => 'Test item', 'amount' => '100', 'taxable' => 'on', // taxable ), array( 'qty' => '1', 'title' => 'Another test item', 'amount' => '20', 'taxable' => false, // not taxable ), ); update_post_meta( $invoice_id, '_sliced_items', $line_items ); // set status as draft: Sliced_Invoice::set_as_draft( $invoice_id ); // anything else you want to add here... /** * That's it! */ return $invoice_id; } // 'init' is a good place to hook into. // The Sliced Invoices plugin will be fully loaded by this point: add_action( 'init', 'sliced_create_invoice_programmatically_example' );
My best,
AndrewForum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] Example of quote add more fieldsHello Augustin
I think it’s possible if you have enough PHP development skills. I’m not an expert in all the hooks Sliced Invoices provides but I think there should be something for customizing the parts of the resulting invoice document, such as description or title. But to be honest, I can’t remember any request like yours. So I think we don’t have a solution out of the box. Please check our code snippets page and the Gists from our lead developer. This might appear useful. Also, I’d suggest you to share your ideas with us in the more preferred way by submitting it on the Feature requests page. Unfortunately we are unable to provide custom coding due to very tight schedule.
My best,
AndrewThank you very much. We do our best to meet expectations of our customers.
Forum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] Title fieldHello there
As far as I understand, the reason is that the custom post types which are used for Invoices and Quotes, require the title to be set. In other words, as well as you can’t create a blog post without a title, you cannot have an anonymous invoice or quote saved into the WordPress database. But I think you can simply have any random field you like to be populated and used as a title.
My best,
AndrewNo problem
I hope someday you will get back and start using Sliced Invoices
My best,
AndrewHello there
Have you tried using WordPress debug? This usually helps learning more about server-side issues.
My best,
AndrewForum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] Quote accept buttonHello Patrick
It seems the reason is the is_feed conditional tag which should be used after the WordPress query is run. In your case you’re trying to call the query result before the query is processed. That’s the error message is about.
But I can’t guess what exactly is happening on your side. I hope it helps. Please learn your code and I hope you’ll find the way to fix the issue.
My best,
Andrew- This reply was modified 5 years, 11 months ago by Andrew Reva.
Hello there
You can use our Easy Translate Extension in order to change the labels you are asking about. The idea of the extension is to translate the plugin to another language but you can use it for changing some text labels as well.
Also you may try using this snippet (I haven’t tried it for this purpose but it may work).
As for the sticky panel with the payment button, you are free to position it anywhere you like. Sometimes our customers ask for customizing and there were no troubles with it. You are free to use your custom CSS in order to change the positioning and/or the appearance of the panel or the payment button.
My best,
AndrewForum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] Quote accept buttonHello there
Do you see any JavaScript error in your browser’s Console? Also I’d recommend you to turn WP_DEBUG on in order to know more about possible php and/or server-side errors. Maybe you have to temporary disable third-party plugins in order to make sure there is no plugin conflict happened.
I hope this will help.
My best,
AndrewHello
Thank you for reaching out. Maybe this snippet will help you.
add_filter( 'sliced_get_email_recipient', 'sliced_custom_add_recipient', 10, 3 ); function sliced_custom_add_recipient( $output, $id, $type ) { if ( $type === 'payment_received' ) { $output .= ', [email protected]'; } return $output; }
It allows for adding an email recipient. I hope this will help you.
My best,
AndrewForum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] sliced invoice errorHello Monika
Thank you for contacting us. I’m learning the problem. I’ll let you know once I have any news.
My best,
AndrewHello
Since you’re our customer, could you please create another ticket here? I simply don’t want to ask you for your server’s details here because it would be visible for everyone. In your ticket please attach your System Info from Sliced Invoices > Tools page.
Thank you in advance,
AndrewHello
I’d recommend you to try hiding the unwanted table cells of the document with your custom CSS. It’s easy to inspect the necessary .sliced- classes for almost everything in the document with your browser’s Developer Tools (e.g. RMB click and choose the Inspect Element item, and you’ll see the DevTools panel).
I hope it helps. Or please let me know if not so I could prepare some WP hooks for you.
Cheers,
AndrewForum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] CurrencyHello again
You are right but this isn’t a bug. The currency is set for your previous quotes remains the same until you change it on the right sidebar in the Payment Settings section. There are currency and payment settings which are stored individually for every single quote/invoice. As for the settings (Sliced Invoices > Settings > Payments page) they are kept as the most often used default values. But every time you create a new document you can override those defaults.
Now I hope you understand how it works.
My best,
Andrew- This reply was modified 6 years, 1 month ago by Andrew Reva.
Forum: Plugins
In reply to: [Sliced Invoices - WordPress Invoice Plugin] CurrencyHello and thank you for reporting the problem I’ll check everything and let you know if it’s really a bug.
My best,
Andrew