Description
When an order is received in WooCommerce, a PDF invoice for Japan is generated and sent by email.
他のプラグインとの連携
- WooCommerce が必要です。
請求書
- 2023年10月からの日本のインボイス制度に対応。
- 個別の登録番号の登録と表示
- 適格請求書(注文状況進行中、注文状況完了済み、の際に請求書としてメールへ PDF として添付し送信)
- 適格返還請求書(払戻の際に払戻明細書としてメールへ PDF として添付し送信)
- クーポンによる割引に対応
- 送料に対応
ライブラリ
動作
フィルター
/** ==================================================
* 請求書メール本文付記
*
*/
add_filter(
'invoice_japan_order_mail_body',
function() {
return 'お買い上げありがとうございます。';
},
10,
1
);
/** ==================================================
* 払戻明細書メール本文付記
*
*/
add_filter(
'invoice_japan_refund_mail_body',
function(){
return '誠に恐れ入りますが、この度の御返金の理由について一言ご連絡をいただけるとありがたいです。';
},
10,
1
);
/** ==================================================
* 送信メールへの追加ファイル
*
*/
add_filter(
'invoice_japan_attache',
function( $attachements ) {
$attachements[] = '/home/public_html/test/wordpress/wp-content/uploads/test.jpg';
return $attachements;
},
10,
1
);
/** ==================================================
* 送信メールアドレスの追加
*
*/
add_filter(
'invoice_japan_mail',
function( $send_mails ) {
$send_mails[] = 'test2@testshop.test';
return $send_mails;
},
10,
1
);
/** ==================================================
* 出力 html の変更
*
/**
* $id
* int
* 注文番号あるいは払い戻し番号
*/
/**
* $store_info_arr
* array
* 店舗情報
'postcode' => 〒郵便番号,
'address' => 住所,
'add_text' => 店舗の付記情報,
'number' => 登録番号:T*************,
*/
/**
* $info_arr
* array
* 受注先の情報
'name' => 氏名,
'date' => 日時,
'shipping_name' => 配送先の氏名,
'billing_postcode_text' => 請求先の郵便番号,
'billing_address_text' => 請求先の住所,
'billing_company_text' => 請求先の会社名,
'shipping_postcode_text' => 配送先の郵便番号,
'shipping_address_text' => 配送先の住所,
'shipping_company_text' => 配送先の会社名,
'title_text' => タイトル(請求書、払戻明細書),
'title_money_text' => 金額,
'title_grand_total_text' => 請求金額(税込み)、払戻金額(税込み),
'order_refund_num_text' => 注文番号:$d、払戻番号:$d,
'order_refund_date_text' => 注文日:$s、払戻日:$s,
'order_refund_payment_text' => 払戻方法:$s,
*/
/**
* $items[ $product_id ] key $product_id は商品ID
* array
* 個別の受注の情報
'name' => 品名,
'quantity' => 数量,
'total' => 金額,
*/
/**
* $total_taxs
* array
* 合計金額
'grand_total' => 請求金額,
'total' => 税抜き合計,
'total_tax' => 消費税合計,
'reduced' => 軽減税率対象品税抜き合計,
'reduced_tax' => 軽減税合計,
'normal' => 標準税率対象品税抜き合計,
'normal_tax' => 標準税合計,
'shipping_total' => 送料税抜き,
'shipping_tax' => 送料消費税,
*/
/**
* $discount_arr
* array
* 値引き金額
'discount_total' => 値引き金額合計,
'discount_reduced' => 軽減税の値引き金額,
'discount_normal' => 標準税の値引き金額,
'discount_reduced_total' => 値引き後の軽減税率対象品税込み合計,
'discount_normal_total' => 値引き後の標準税率対象品税込み合計,
'discount_total_reduced_tax' => 税込み価格に対する軽減税( 8/108 ),
'discount_total_normal_tax' => 税込み価格に対する標準税( 10/110 ),
*/
/**
* $flag
* string
* フラグ
'order' 請求書
'refund' 払戻明細書
*/
add_filter(
'invoice_japan_order_generate_html',
function ( $html, $id, $store_info_arr, $info_arr, $items, $total_taxs, $discount_arr, $flag ) {
$html = '<h1>' . $info_arr['title_text'] . '</h1>';
$html .= '<div>' . $info_arr['order_refund_num_text'] . '</div>';
$html .= '<div>登録番号:' . $store_info_arr['number'] . '</div>';
/* Your code */
return $html;
},
10,
8
);
/** ==================================================
* 標準ライブラリの TCPDF をオフにする場合。
* 以下の、'invoice_japan_pdf_write'フィルターと組み合わせで使用。
*
*/
add_filter( 'invoice_japan_tcpdf_off', function(){ return true; }, 10, 1 );
/** ==================================================
* 外部ライブラリを使用して html から PDF を生成。
* 上記の、'invoice_japan_tcpdf_off'フィルターを true にして使用。
*
* @param string $pdf_file pdf のフルパスファイル名.
* @param string $html html.
* @param array $info_arr infomation.
* @return bool pdf の生成が成功したら true を返し、失敗したら false を返す.
*/
add_filter(
'invoice_japan_pdf_write',
function( $pdf_file, $html, $info_arr ) {
/* Your code */
return true;
},
10,
2
);
Installation
/wp-content/plugins/
ディレクトリ以下にpdf-invoice-japan-for-woocommerce
ディレクトリをアップロードします。- WordPress の「プラグイン」メニューからプラグインを有効化してください
FAQ
ありません
Reviews
There are no reviews for this plugin.
Contributors & Developers
“PDF Invoice Japan for WooCommerce” is open source software. The following people have contributed to this plugin.
Contributors“PDF Invoice Japan for WooCommerce” has been translated into 1 locale. Thank you to the translators for their contributions.
Translate “PDF Invoice Japan for WooCommerce” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.04
アドオンの為のコードを追加しました。
1.03
不要なコードを除去しました。
1.02
店舗情報の生成を html 生成時では無く、html 生成前に修正しました。
‘invoice_japan_pdf_write’ フィルターの中での戻り値に、bool 値を指定する仕様にしました。
readme.txt を修正しました。
1.01
インストール時の不具合を修正しました。
1.00
初回リリース。